#9038: url tag not working with reverse in 1.0 as it previously did
------------------------------------------+---------------------------------
          Reporter:  [EMAIL PROTECTED]  |         Owner:  mtredinnick 
            Status:  assigned             |     Milestone:              
         Component:  Core framework       |       Version:  1.0         
        Resolution:                       |      Keywords:  url, reverse
             Stage:  Unreviewed           |     Has_patch:  0           
        Needs_docs:  0                    |   Needs_tests:  0           
Needs_better_patch:  0                    |  
------------------------------------------+---------------------------------
Comment (by wreese):

 We used the following code to work around this bug. The code removes items
 from args and kwargs where the value is empty or None, then calls the real
 reverse function with the correct args and kwargs.

 {{{
 from django.core.urlresolvers import reverse as django_reverse

 def reverse(*args,**kw):
   if 'args' in kw: kw['args'] = tuple((a for a in kw['args'] if a))
   if 'kwargs' in kw: kw['kwargs'] = dict(((k,v) for k,v in
 kw['kwargs'].items() if v))
   return django_reverse(*args,**kw)
 }}}

 This works fine in the views, but it does not fix the "url" template tags
 which use Django's reverse function.  You could update the "URLNode" class
 in django/template/defaulttags.py, so the "render" method redefines
 "reverse" using the code above.


 -- Will Reese

-- 
Ticket URL: <http://code.djangoproject.com/ticket/9038#comment:2>
Django <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