Ulrich Petri
unread,Oct 14, 2009, 6:35:01 PM10/14/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django developers
Hi,
in some projects I've had to interface with external authentication
sources that did expect the return-to URL in other formats than "%
(LOGIN_URL)s?%(redirect_field_name)s=%(url)s" (In one specific case it
was, e.g. required that the return URL had to be base64 encoded).
AFAIK there are currently two ways to accomplish that:
a) Set LOGIN_URL to a view that reformats the return URL and redirects
again (thereby having two redirects in a row)
b) Monkey patch user_passes_test (formerly _CheckLogin)
Neither of which I think are very good options.
So I would like to propose another option:
Allowing LOGIN_URL to be a callable which, in case of
user_passes_test, gets passed the redirect_field_name and return path
and returns the complete target URL.
Deciding whether the given string is a callable or an URL should be
simple; If the string contains at least one '/' it's an URL otherwise
it's a callable.
If it is felt this would be worthwhile to have in django (or if it is
even a good idea) I would be happy to provide a patch.
Thanks,
Ulrich