#3525: {% url path.to.view %} fails with multiple patterns for the same function
-------------------------------+--------------------------------------------
   Reporter:  [EMAIL PROTECTED]  |                Owner:  mtredinnick           
     Status:  assigned         |            Component:  Template system       
    Version:  SVN              |           Resolution:                        
   Keywords:  url, template    |                Stage:  Design decision needed
  Has_patch:  0                |           Needs_docs:  0                     
Needs_tests:  0                |   Needs_better_patch:  0                     
-------------------------------+--------------------------------------------
Changes (by mtredinnick):

  * owner:  adrian => mtredinnick
  * status:  new => assigned

Old description:

> If there are multiple patterns matching the same view function, it seems
> like, only the first match is considered.
> 
> Lets say a function has an optional "id" parameter which defaults to None
> and below is the patterns pointing that function.
> 
> (r'^(?P<slug>[-\w]+)/$', views.myfunc),
> 
> (r'^(?P<slug>[-\w]+)/(?P<id>\d+)/$', views.myfunc),
> 
> In that case,
> 
> {% url views.myfunc slug=something,id=someint %}
> 
> fails to match anything, where we can expect it to match the second
> pattern and return "/something/someint/"

New description:

 If there are multiple patterns matching the same view function, it seems
 like, only the first match is considered.
 
 Lets say a function has an optional "id" parameter which defaults to None
 and below is the patterns pointing that function.
 
 {{{
 #!python
 (r'^(?P<slug>[-\w]+)/$', views.myfunc),
 
 (r'^(?P<slug>[-\w]+)/(?P<id>\d+)/$', views.myfunc),
 }}}
 
 In that case,
 
 {{{
 #!python
 {% url views.myfunc slug=something,id=someint %}
 }}}
 
 fails to match anything, where we can expect it to match the second
 pattern and return "/something/someint/"

Comment:

 Yep. A bug.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/3525#comment:2>
Django Code <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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to