﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
7522	django.core.urlresolvers.reverse can't accept complex regular expression.	bear330	nobody	"I have a url pattern like this:

{{{
url(r'^(?P<strategy>\w+)/(?P<scale>(hours|days))/(?P<duration>[1-365]+)$', 'views.index', name='indexDuration')
}}}

It will fail when I call:


{{{
reverse('indexDuration', args=['trace', 'hours', 24])
}}}


the exception raised:


{{{
...
File ""C:\Program Files\Python25\Lib\site-packages\django\core\urlresolvers.py"", line 88, in reverse_helper
    result = re.sub(r'\(([^)]+)\)', MatchChecker(args, kwargs), regex.pattern)
...
error: unbalanced parenthesis
}}}

This is related to [http://code.djangoproject.com/ticket/6934 #6934], but it also raise exception when I change the url to:


{{{
url(r'^(?P<strategy>\w+)/(?P<scale>hours)/(?P<duration>[1-365]+)$', 'views.index', name='indexDuration')
}}}

{{{
>>> reverse('indexDuration', args=['trace', 'hours', 24])
...
File ""C:\Program Files\Python25\Lib\site-packages\django\core\urlresolvers.py"", line 88, in reverse_helper
    result = re.sub(r'\(([^)]+)\)', MatchChecker(args, kwargs), regex.pattern)
...
NoReverseMatch: Value 24 didn't match regular expression '[1-365]+'
}}}

This is a related but other situation to cause reverse raise exception.
"		closed	Core (Other)	dev		invalid			Unreviewed	0	0	0	0	0	0
