urlresolvers.resolve barfs on regexps with a flag group
|Reported by:||Owned by:||nobody|
|Cc:||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
I think I've just run across a small bug with the reverse() method in urlresolvers.py for URLs that contain a flag group (like (?u)). To replicate, construct a urlconf containing a regexp with a flag group, e.g.
and then use django.core.urlresolvers.reverse to construct a url with parameters:
I get a NoMatchError here (not enough positional arguments), but I don't if I remove the flag group at the beginning of the url regexp.
I've attached a small patch for this issue ; the Python re docs state that a flag group should be the first non-whitespace content in the regexp, so I only cover that case.