#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 anonymous):

 With:
 {{{
 TEMPLATE_DIRS =
 [u"/home/test1/Q-DJANGO1/Para\xedso/fp/web/fpqweb/templates"]
 }}}
 Works in Django test server, but not in apache+mod_python:
 {{{
 UnicodeEncodeError at /

 'ascii' codec can't encode character u'\xed' in position 26: ordinal not
 in range(128)

 Request Method:         GET
 Request URL:    http://localhost/
 Exception Type:         UnicodeEncodeError
 Exception Value:

 'ascii' codec can't encode character u'\xed' in position 26: ordinal not
 in range(128)

 Exception Location:     /var/lib/python-
 support/python2.5/django/template/loaders/filesystem.py in
 load_template_source, line 23
 Python Executable:      /usr/bin/python
 Python Version:         2.5.2
 Python Path:    ['home/test1/Q-DJANGO1/Para\xc3\xadso/fp/web',
 '/usr/lib/python2.5', '/usr/lib/python2.5/plat-linux2',
 '/usr/lib/python2.5/lib-tk', '/usr/lib/python2.5/lib-dynload',
 '/usr/local/lib/python2.5/site-packages', '/usr/lib/python2.5/site-
 packages', '/usr/lib/python2.5/site-packages/Numeric', '/usr/lib/python2.5
 /site-packages/PIL', '/usr/lib/python2.5/site-packages/gst-0.10',
 '/var/lib/python-support/python2.5', '/usr/lib/python2.5/site-
 packages/gtk-2.0', '/var/lib/python-support/python2.5/gtk-2.0',
 '/usr/lib/python2.5/site-packages/wx-2.8-gtk2-unicode']
 Server time:    lun, 8 Sep 2008 17:05:22 +0200
 Unicode error hint

 The string that could not be encoded/decoded was: /Paraíso/fp
 }}}


 With:

 {{{
 import locale
 TEMPLATE_DIRS =
 
[u"/home/test1/Q-DJANGO1/Para\xedso/fp/web/fpqweb/templates".encode(locale.getpreferredencoding())]
 }}}

 In Django test server:

 {{{

 TemplateSyntaxError at /

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

 Request Method:         GET
 Request URL:    http://localhost:8000/
 Exception Type:         TemplateSyntaxError
 Exception Value:

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

 Exception Location:     /var/lib/python-
 support/python2.5/django/template/loader_tags.py in get_parent, line 66
 Python Executable:      /usr/bin/python
 Python Version:         2.5.2
 [...]
 Template error

 In template
 /home/test1/Q-DJANGO1/Paraíso/fp/web/fpqweb/templates/index.html, error at
 line 1
 Template u'base.html' cannot be extended, because it doesn't exist
 1       {% extends "base.html" %}
 2
 3       {% block
 [...]
 }}}

 And in Apache2:
 {{{
 MOD_PYTHON ERROR

 [...]
 URI:            '/'
 Location:       '/'
 Directory:      None
 Filename:       '/var/www/'
 PathInfo:       ''

 Phase:          'PythonHandler'
 Handler:        'django.core.handlers.modpython'

 Traceback (most recent call last):

   File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line
 1537, in HandlerDispatch
     default=default_handler, arg=req, silent=hlist.silent)

   File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line
 1229, in _process_target
     result = _execute_target(config, req, object, arg)

   File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line
 1128, in _execute_target
     result = object(arg)

   File "/var/lib/python-
 support/python2.5/django/core/handlers/modpython.py", line 222, in handler
     return ModPythonHandler()(req)

   File "/var/lib/python-
 support/python2.5/django/core/handlers/modpython.py", line 185, in
 __call__
     self.load_middleware()

   File "/var/lib/python-support/python2.5/django/core/handlers/base.py",
 line 31, in load_middleware
     for middleware_path in settings.MIDDLEWARE_CLASSES:

   File "/var/lib/python-support/python2.5/django/conf/__init__.py", line
 28, in __getattr__
     self._import_settings()

   File "/var/lib/python-support/python2.5/django/conf/__init__.py", line
 59, in _import_settings
     self._target = Settings(settings_module)

   File "/var/lib/python-support/python2.5/django/conf/__init__.py", line
 92, in __init__
     mod = __import__(self.SETTINGS_MODULE, {}, {}, [''])

   File "/home/test1/Q-DJANGO1/Paraíso/fp/web/fpqweb/settings.py", line
 103, in <module>
     TEMPLATE_DIRS =
 
[u"/home/test1/Q-DJANGO1/Para\xedso/fp/web/fpqweb/templates".encode(locale.getpreferredencoding())]

 UnicodeEncodeError: 'ascii' codec can't encode character u'\xed' in
 position 26: ordinal not in range(128)
 }}}

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