On Tue, May 4, 2010 at 3:28 AM, Derek <gamesb...@gmail.com> wrote:

> 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).
>
>
debug_toolbar appears in the traceback. So I'd first ask if the problem goes
away if you disable the debug_toolbar middleware? If yes, then the next
question would be are you running the most recent debug_toolbar? If not, I'd
try updating to the latest, since this may be a problem that's already been
fixed. If the problem still occurs with the latest release of debug_toolbar
I'd start by looking around here:
http://github.com/robhudson/django-debug-toolbar/issues to see if the
problem has been reported.

Karen

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to