On Sunday, July 7, 2013 12:47:28 PM UTC-7, [email protected] wrote:
>
> Hello,
>
> I just started working with Trac in a virtualenv through WSGI, and I got a 
> "decoding Unicode is not supported" when I tried to access the homepage 
> with the following stack trace:
>
> webob/request.py:887 in call_application
>     app_iter = application(self.environ, start_response)
> trac/web/main.py:465 in dispatch_request
>     return _dispatch_request(req, env, env_error)
> trac/web/main.py:504 in _dispatch_request
>     send_internal_error(env, req, sys.exc_info())
> trac/web/main.py:620 in send_internal_error
>     description_en = get_description(lambda s, **kw: safefmt(s, kw))
> trac/web/main.py:615 in get_description
>     method=req.method, path_info=req.path_info,
> trac/web/api.py:338 in path_info
>     return unicode(path_info, 'utf-8')
>
> I just started with Trac so I don't really know what I am doing but I 
> replace unicode by to_unicode and everything works fine now.
> Can someone tell me if it is a bug in Trac or if it is a bug outside Trac ?
> If it is in Trac I can trry to open a ticket for this bug.
>

I suppose that change works because `to_unicode` will fall through in the 
case that the input is a unicode string:
http://trac.edgewall.org/browser/tags/trac-1.0.1/trac/util/text.py?marks=71#L46

What is the content of your WSGI script?
http://trac.edgewall.org/wiki/TracModWSGI#Thetrac.wsgiscript

If I was debugging it, I would next try to determine the contents of the 
WSGI `environ` dictionary that get passed to `dispatch_request`, and try to 
figure it why it presumably contains Unicode strings while Trac is 
expecting acii strings.

However, it looks like the error is a side-effect of some other problem, as 
there appears to be an exception thrown in the try body of 
_dispatch_request:
http://trac.edgewall.org/browser/tags/trac-1.0.1/trac/web/main.py?marks=493-500,504#L485
... so it's a bit confusing that you don't see the internal error page 
displayed after making the `unicode` -> `to_unicode` change.

Posting the versions of Python, WSGI, etc ... that you are using might help 
someone else spot the problem.

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to