#17566: RegexURLResolver.__repr__(self) is not unicode safe.
-------------------------------+---------------------------------------
     Reporter:  otto           |                    Owner:  nobody
         Type:  Uncategorized  |                   Status:  reopened
    Component:  Core (URLs)    |                  Version:  1.4-alpha-1
     Severity:  Normal         |               Resolution:
     Keywords:  unicode        |             Triage Stage:  Unreviewed
    Has patch:  1              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  0              |                    UI/UX:  0
-------------------------------+---------------------------------------

Comment (by vitalije):

 Replying to [comment:5 ptone]:

 > This is largely unrelated to the original ticket - but the app_name is
 derived from the import path of the app - assigning a different
 Meta.app_label does not actually change the app_name, but in this case the
 resolver isn't even getting that far.
 >
 I must admit I was wrong to believe that app_name is problem. After
 thorough investigation I have found that app_name is plain ascii =
 'admin'. But I have found that self.regex.pattern is unicode. When I
 replaced definition of method __repr__

 {{{
 def __repr__(self):
     return return smart_str(u'<%s %s (%s:%s) %s>'
 %(self.__class__.__name__, self.urlconf_name, self.app_name,
 self.namespace, self.regex.pattern))
 }}}
 with the following definition

 {{{
 def __repr__(self):
     return '<%s %s (%s:%s) %s>' %tuple(map(smart_str,
 (self.__class__.__name__, self.urlconf_name, self.app_name,
 self.namespace, self.regex.pattern)))
 }}}
 the problem was solved.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/17566#comment:6>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to