#8764: Mixing args and **kwargs in reverse() function
----------------------------------------+-----------------------------------
 Reporter:  tolano                      |       Owner:  nobody    
   Status:  new                         |   Milestone:  1.0       
Component:  Core framework              |     Version:  SVN       
 Keywords:  reverse function exception  |       Stage:  Unreviewed
Has_patch:  0                           |  
----------------------------------------+-----------------------------------
 Changeset [8760] introduced this exception: "Don't mix *args and
 **kwargs in call to reverse()!"

 {{{
 django/trunk/django/core/urlresolvers.py
 def reverse(self, lookup_view, *args, **kwargs):
     if args and kwargs:
         raise ValueError("Don't mix *args and **kwargs in call to
 reverse()!")
 }}}

 [8760] was suppose to be backwards compatible but is not. My question is:
 Why is not possible to mis args and kwargs? I don't understand the
 reason, and all of my reverse funcions will fail because of this.

 I'll write an example of the problem. All my urls are prepared
 following the best SEO rules, so in many places I have urls like:
 (r'^(.*)-f(?P<id>\d+)\.html$','view_photo')

 this would make the url:
 my-photo-f2.html

 I get the url using:

 {{{
 reverse('app.views.view_photo', args=[slugify(photo.title)],
 kwargs={'id':id})
 }}}
 (Note: I don't want to use a slug field.)

 Now this won't work. Well, IMHO this is a bug. I don't see any reason why
 the reverse function shouldn't work the same way as it did before. Aplying
 a patch and make the funcion so limited is not appropiated.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/8764>
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