#29597: AttributeError when django.template.context_processors.debug is invoked
with null request
-------------------------------------------+------------------------
Reporter: eshellman | Owner: nobody
Type: Bug | Status: new
Component: Template system | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 1
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-------------------------------------------+------------------------
When the DjangoTemplates engine is used to render a template with a null
request (for example, when used in render_to_string to render an email
body) this line:
{{{
if settings.DEBUG and request.META.get('REMOTE_ADDR') in
settings.INTERNAL_IPS:
}}}
raises an AttributeError: 'dict' object has no attribute 'META'
This should be replaced by:
{{{
if settings.DEBUG and request and request.META.get('REMOTE_ADDR') in
settings.INTERNAL_IPS:
}}}
otherwise, the debug context processor cannot be use for systems that
render templates without a request.
--
Ticket URL: <https://code.djangoproject.com/ticket/29597>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/052.49ec973bc58c1ec8a579efd85ba8087e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.