On Aug 22, 6:42 am, Jonathon Anderson <[email protected]> wrote:
> I have a pylons app using repoze.what+repoze.who for auth^2. The
> RedirectingFormPlugin in repoze.who middleware wants to know the login
> and logout urls for automatic redirection (login_form_url,
> login_handler_path, and logout_handler_path). How can I get the
> return value of, for example, url('login') within config/middleware.py?
I hope someone has a better answer, but here's one way:
# environment.py
from routes.util import URLGenerator
def load_environment(...):
config['routes.map'] = make_map(...)
# ...
url = URLGenerator(config['routes.map'], {})
config['logout_url'] = url('logout')
# ...
return config
Note that the `url` function you get back here can't do everything
that `pylons.url` can because its environ (the second arg to
URLGenerator) is empty. For example, you can't generate a fully
qualified URL.
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" 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/pylons-discuss?hl=en.