Steps to reproduce the problem:
- Quickstart a TG2 project with authorization
- Setup the database and run the project with --reload
- Surf to http://localhost:8080/manage_permission_only
- You get an error message "Only for managers"
- In the require decorator of the
controllers.root.manage_permission_only method,
set msg=l_(u'Nur für Mänätscher'), i.e. put some
non-ascii chars in the error message
(make sure you have an encoding hint at the top of the file).
- Surf to http://localhost:8080/manage_permission_only
- You get an UnicodeEncodeError
Cause: The error message cannot be converted to unicode
Solution: In repoze.what.predicates, add the following method
to the PredicateError class:
class PredicateError(Exception):
def __unicode__(self):
return unicode(self.message)