On Mon, 2009-07-27 at 16:30 +0530, Kenneth Gonsalves wrote:
> hi
> latest trunk.
> in my urls.py I have a url:
> 
> url(r'^addlandmark/((?P<id>\d+)/)?$', 'addlandmark', name='add_landmark'),

You have nested capturing groups here, which is almost always an error.
You have also mixed positional and named arguments, for bonus confusion
(if they weren't nested, it would be a bug). In any case, URL reversing
can't handle anything except the outermost capturing groups in a
reg-exp.

I suspect you intend your pattern to be

        r'^addlandmark/(?:(?P<id>\d+)/)?$'
        
changing the optional portion to be a non-capturing group. Then your
pattern only takes (and captures) a single keyword argument parameter:
id.

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to