here is the urlpatterns
url(r'^test/1/?',views.test1,name='test1'),
url(r'^(?i)test/2/?$',views.test2,name='test2'),
then i test the reverse function as follows:
>>> from django.core.urlresolvers import reverse
>>> print reverse('test1')
/test/1/?
the url i expect is '/test/1/' instead of '/test/1/?'
the '?' in the urlpatterns was add for matching both '/test/1/' and '/test/1'
>>> print reverse('test2')
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "....django\django\core\urlresolvers.py", line 297, in
reverse
File "....django\django\core\urlresolvers.py", line 283, in
reverse
File "....django\django\core\urlresolvers.py", line 88, in
reverse_helper
File "C:\Python25\lib\re.py", line 142, in sub
return _compile(pattern, 0).sub(repl, string, count)
File "....\django\django\core\urlresolvers.py", line 124, in
__call__
NoReverseMatch: Not enough positional arguments passed in
(?i) was added for matching '/test/2' or '/Test/2' and so forth