The online documentation has the following example in this section:
http://docs.djangoproject.com/en/1.0/topics/i18n/#standard-translation
from django.utils.translation import ugettext as _
def my_view(request):
output = _("Welcome to my site.")
return HttpResponse(output)
My example looks like this:
def my_function(request):
output = _("Activities")
return HttpResponse(output)
and generates this error when called:
Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/django/core/servers/basehttp.py",
line 279, in run
self.result = application(self.environ, self.start_response)
File "/usr/lib/python2.5/site-packages/django/core/servers/basehttp.py",
line 651, in __call__
return self.application(environ, start_response)
File "/usr/lib/python2.5/site-packages/django/core/handlers/wsgi.py",
line 245, in __call__
response = middleware_method(request, response)
File "/usr/lib/python2.5/site-packages/debug_toolbar/middleware.py",
line 91, in process_response
response.content =
replace_insensitive(smart_unicode(response.content), u'</body>',
smart_unicode(self.debug_toolbars[request].render_toolbar() +
u'</body>'))
File "/usr/lib/python2.5/site-packages/django/http/__init__.py",
line 365, in _get_content
return smart_str(''.join(self._container), self._charset)
TypeError: sequence item 0: expected string, __proxy__ found
As soon as I remove the _() it works just fine.
Any clues as to what could be the cause? (I am running Django 1.1 on a
local desktop, using the development server).
Thanks
Derek
--
You received this message because you are subscribed to the Google Groups
"Django users" 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-users?hl=en.