On 8/31/2013 12:19 PM, Saint Germain wrote:
> Hello,
> 
> I had to make the following patch to make Trac work on my Debian
> Testing.

What kind of error did you have? Did it correspond to the HTTPNotFound
error that should be raised in case PATH_INFO doesn't have an UTF-8
encoding? Or was it something else?

More information about the URL, the web browser and the web server would
help put this error in perspective.

> I don't know if the patch is correct though, as I have blindly made the
> change without really understanding.

No, likely not. The PATH_INFO should come in being utf-8 encoded, and if
that's not the case it's better to trap the error early rather than
force the conversion to succeed and have a failure later, when the
source of the error will be harder to figure out.

-- Christian

> 
> --- api-old.py        2013-08-31 12:12:06.236050960 +0200
> +++ api.py    2013-08-31 12:15:21.064055948 +0200
> @@ -340,7 +340,7 @@
>          """Path inside the application"""
>          path_info = self.environ.get('PATH_INFO', '')
>          try:
> -            return unicode(path_info, 'utf-8')
> +            return to_unicode(path_info, 'utf-8')
>          except UnicodeDecodeError:
>              raise HTTPNotFound(_("Invalid URL encoding (was %(path_info)r)",
>                                   path_info=path_info))
> 
> Best regards,
> 

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Development" 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-dev.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to