When I create a custom inclusion tag, I commonly use the `takes_context=True` functionality, which passes in the current context into the custom tag's function as the first parameter, `context`. I recently ran into an issue with admittedly how *I* sometimes write these tags.
Depending on the use case, I return a `dict` as necessary - no problems here. However sometimes I need more information that is present in the `context` passed in, so I simply repurpose `context`, adding new values to it and then returning `context` itself. This __usually__ works fine, except in the case demonstrated in the ticket I created here: https://code.djangoproject.com/ticket/26041 - see the sample project. The problem encountered in that project is caused by the fact that `context` is of type RequestContext, not a `dict`. If I instead `return context.flatten()` instead of `return context` in my custom tag, everything works fine. I'm wondering if it might be a good idea to check the result from all inclusion tags (which in the docs is recommended to be a `dict`, but is a `RequestContext` in my case) and if it is of type `Context` or `RequestContext` call `flatten()` on it. Looking for feedback here. Thanks. James Addison -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at https://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/1dbc41cd-c446-4e16-a300-aa683a1daf65%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.