#2250: [PATCH] Repoze.what cannot handle non-ascii error messages
------------------------+---------------------------------------------------
 Reporter:  chrisz      |       Owner:             
     Type:  defect      |      Status:  new        
 Priority:  high        |   Milestone:  2.0rc1     
Component:  TurboGears  |     Version:  2.0b6      
 Severity:  major       |    Keywords:  repoze.what
------------------------+---------------------------------------------------
 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)
 }}}

-- 
Ticket URL: <http://trac.turbogears.org/ticket/2250>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "TurboGears Tickets" group.
This group is read-only. No posting by normal members allowed.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/turbogears-tickets?hl=en?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to