#3530: django.db.models.permalink should use request.urlconf if defined
-----------------------------------------------------+----------------------
Reporter: Herbert Poul <[EMAIL PROTECTED]> | Owner: adrian
Status: new | Component:
Core framework
Version: SVN | Resolution:
Keywords: urlconf permalink ROOT_URLCONF | Stage:
Accepted
Has_patch: 1 | Needs_docs: 0
Needs_tests: 0 | Needs_better_patch: 0
-----------------------------------------------------+----------------------
Comment (by mtredinnick):
@ubernostrum: the extra function arg is optional in both Herbet's and my
version. It's fully backwards compatible.
@Herbet: I'd leave it out. It an extra assupmtion in the permalink()
function we have to remember and maintain and it's not needed (i.e. it
doesn't really make any external code significantly more complex if we
leave it out). The reduced version says 'give me what I need', your
original interface was 'give me what I need or something that is kind of
like what I need and I'll rummage around inside and pull out what I need'.
We don't need the second option.
It's the difference between get_urlconf_function being
{{{
#!python
lambda : get_current_user() # with your API
}}}
versus
{{{
#!python
lambda : get_current_user().urlconf # with my API
# or lambda : getattr(get_current_urse(), 'urlconf', None) to be really
robust
}}}
and it saves at least two lines of code in permalink().
My preference is to keep the core code as simple as possible and if we're
adding a new interface, as here, add the smallest interface necessary. I
realise neither way is a disaster, but neatness counts.
--
Ticket URL: <http://code.djangoproject.com/ticket/3530#comment:9>
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
-~----------~----~----~----~------~----~------~--~---