#8965: UnicodeEncodeError in template path after migration from Django 0.96 to 
1.0
------------------------------------+---------------------------------------
          Reporter:  anonymous      |         Owner:  nobody
            Status:  new            |     Milestone:        
         Component:  Uncategorized  |       Version:  1.0   
        Resolution:                 |      Keywords:        
             Stage:  Unreviewed     |     Has_patch:  0     
        Needs_docs:  0              |   Needs_tests:  0     
Needs_better_patch:  0              |  
------------------------------------+---------------------------------------
Comment (by Daniel Pope <[EMAIL PROTECTED]>):

 Apache is running in the wrong locale: {{{locale.getpreferredencoding()}}}
 is returning an ASCII character set.

 I've had a look at my servers and both Debian and Ubuntu include the line:

 {{{
 ENV="env -i LANG=C PATH=/usr/local/bin:/usr/bin:/bin"
 }}}

 as one of the first lines in {{{/etc/init.d/apache2}}}.

 Replace {{{LANG=C}}} with {{{LC_ALL=*your locale*}}} and restart Apache,
 and mod_python should then be able to open Unicode paths.

 The

 {{{
 Template u'base.html' cannot be extended, because it doesn't exist
 }}}

 error is subtle, but simply put, you cannot specify non-ASCII bytestrings
 in TEMPLATE_DIRS.

 Full explanation: {{{ {% extends "base.html" %} }}}is now interpreted as a
 unicode template filename {{{u'base.html'}}} which causes a
 {{{UnicodeDecodeError}}} when {{{os.path.join}}}ed with the template dir
 as the loader searches for the template. Unfortunately it
 
[http://code.djangoproject.com/browser/django/trunk/django/template/loaders/filesystem.py#L15
 gets swallowed] because {{{UnicodeDecodeError}}} is a subclass of
 {{{ValueError}}}, and {{{ValueError}}} is also raised when {{{safe_join}}}
 detects that the join is not safe.

 The errors from safe_join should not be silently ignored. Suppressing them
 makes it hard to debug. There could also be a better error message when
 searching {{{TEMPLATE_DIRS}}} raises {{{UnicodeDecodeError}}}.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/8965#comment:3>
Django Code <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
-~----------~----~----~----~------~----~------~--~---

Reply via email to