#3683: permalink decorator takes redundant arguments
---------------------------+------------------------------------------------
Reporter: SmileyChris | Owner: adrian
Status: new | Component: Core framework
Version: SVN | Resolution:
Keywords: | Stage: Unreviewed
Has_patch: 1 | Needs_docs: 0
Needs_tests: 0 | Needs_better_patch: 0
---------------------------+------------------------------------------------
Comment (by mtredinnick):
OK, now I really don't understand what the bug is here. The function that
is going to be decorated with {{{permalink()}}} needs to return a two- or
three-tuple, where the optional third element is a dictionary of keyword
args when calling the view. So, yes, if you want to use the third argument
and pass in no positional args, the positional arg element must be an
empty sequence. We can document that. It's not a bug, though.
Secondly, you say {{{reverse()}}} cannot use a mixture of positional and
keyword args, but that isn't correct:
{{{
#!python
In [2]: reverse('views.example', args=(20,), kwargs={'fred': 2006})
Out[2]: '/foo/2006/20/'
}}}
where the associated urlpatterns entry was
{{{
#!python
(r'foo/(?P<fred>\d{4})/(\d{1,2})/$', 'views.example'),
}}}
So, whilst I'm willing to admit I'm missing something still, I cannot see
the bug here, the more I think this. I'll add to your docs patch in #3540
to add an example with keyword args, but as far as I can see, this is
working as advertised. Or...?
--
Ticket URL: <http://code.djangoproject.com/ticket/3683#comment:4>
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
-~----------~----~----~----~------~----~------~--~---