#27794: Fix confusing error messages for broken `context_processors`
-------------------------------------+-------------------------------------
               Reporter:  Elena      |          Owner:  (none)
  Williams                           |
                   Type:             |         Status:  new
  Uncategorized                      |
              Component:  Error      |        Version:  1.10
  reporting                          |       Keywords:  errors,
               Severity:  Normal     |  context_processors
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 If there is something broken about one or many items in
 `context_processors` produces the error message:

 {{{
 No module named context_processors
 }}}

 A better error message would say that an item was broken, not that the
 module doesn't exist (it usually does exist).

 Preferably mention which item is broken.

 This is confusing when either `TEMPLATES['OPTIONS']['context_processors']`
 or `TEMPLATE_CONTEXT_PROCESSORS` ''do'' exist. Particularly when upgrading
 or when the `context_processors` list is quite long.


 Can be trivially replicated by starting a new project and adding any
 syntactically correct, but otherwise broken entry to `context_processors`
 list, for example:

 {{{
 TEMPLATES = [
     {
         'BACKEND': 'django.template.backends.django.DjangoTemplates',
         'DIRS': [],
         'APP_DIRS': True,
         'OPTIONS': {
             'context_processors': [
                 'broken.context_processors',
                 'django.template.context_processors.debug',
                 'django.template.context_processors.request',
                 'django.contrib.auth.context_processors.auth',
                 'django.contrib.messages.context_processors.messages',
             ],
         },
     },
 ]
 }}}

 Examples of this having confused users is discussed:
 http://stackoverflow.com/questions/32828536/django-no-module-named-
 context-processors-error-after-reboot
 http://stackoverflow.com/questions/38772498/importerror-no-module-named-
 context-processors

--
Ticket URL: <https://code.djangoproject.com/ticket/27794>
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/048.26d6531e23a137ca36daaf3ab36eea5c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to