#12650: Some contrib apps depend on the i18n context processor to output valid
XHTML
-----------------------------------+----------------------------------------
Reporter: robhudson | Owner: ramiro
Status: reopened | Milestone:
Component: Contrib apps | Version: 1.1
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
-----------------------------------+----------------------------------------
Changes (by ramiro):
* status: closed => reopened
* resolution: worksforme =>
* has_patch: 0 => 1
* component: Uncategorized => Contrib apps
Comment:
Please ignore all my babbling about where the i18n context processor gets
the value of `LANGUAGE_NAME` from, the point is such context processor not
being present at all.
As for why the test case I had created was showing the `LANGUAGE_CODE=en`
value was present in the context of the admin, the reason was:
* The test machinery hard-codes `LANGUAGE_NAME` to `'en'`.
* The i18n context processor is in the default
`TEMPLATE_CONTEXT_PROCESSORS` setting set by `global_settings.py`
* The internal list of context processors is generated once from
`TEMPLATE_CONTEXT_PROCESSORS` and then
[http://code.djangoproject.com/browser/django/trunk/django/template/context.py?rev=11862#L5
cached].
This explains why the XHTML header contained `'lang="en" xml:lang="en"'`
showing no failure (OTOH Rob's and my own live testing with the admin app
showed invalid XHTML headers were being generated). Also, the test
passed/failed depending if another test case with was run before or not.
Even when I was munging with `settings.TEMPLATE_CONTEXT_PROCESSORS` to
remove the i18n context processor, that change had no effect in the
processing of the request made by the test client. I solved this in a
somewhat hacky way: I reset the internal cache of context processors used
by `RequestContext` after I modify that setting.
Thanks Rob for insisting on this.
--
Ticket URL: <http://code.djangoproject.com/ticket/12650#comment:7>
Django <http://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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.