#10798: RegexUrlResolver's _get_reverse_dict appends objects of unknown type to 
the
reverse dict
-----------------------------------------------------------------+----------
 Reporter:  fas                                                  |       Owner: 
 fas       
   Status:  new                                                  |   Milestone: 
           
Component:  Core framework                                       |     Version: 
 1.0       
 Keywords:  url, urlresolver, regexurlpattern, regexurlresolver  |       Stage: 
 Unreviewed
Has_patch:  1                                                    |  
-----------------------------------------------------------------+----------
 In _get_reverse_dict:
 {{{
 if isinstance(pattern, RegexURLResolver):
     # ...
 else:
     bits = normalize(p_pattern)
     self._reverse_dict.appendlist(pattern.callback, (bits, p_pattern))
     self._reverse_dict.appendlist(pattern.name, (bits, p_pattern))
 }}}

 In the else branch it is implicitly assumed that pattern is of type
 RegexURLPattern (it uses its properties). This does not have to be the
 case. For example, one could create a different kind of RegexURLResolver
 which does not inherit RegexURLResolver. This resolver would be handled as
 a RegexURLPattern instance and added to the reverse dict.
 Patch is a short one: replace "else" with "elif isinstance(pattern,
 RegexURLPattern):".

-- 
Ticket URL: <http://code.djangoproject.com/ticket/10798>
Django <http://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 this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to