Here's my second question.
URL generation seems awkward when using hybrid URL dispatch &
traversal.
I suspect I'm missing something what is it?
I have a route like:
config.add_route('admin', 'admin/*traverse',
factory='.models.get_admin_root')
and a bunch of views defined with route_name='admin'.
The dispatch is working fine, but I'm having trouble figuring out to
generate urls.
request.model_url(context)
yields an incorrect URL (no leading /admin in the path.) Route_url()
can be made to
work, but takes a bit of work — something like this
def admin_model_url(context, request, *elements, **kwargs):
options = dict( ('_'+k, v) for k, v in kwargs.iteritems() )
options['traverse'] = traversal_path(model_path(context))
return request.route_url('admin', *elements, **options)
(another option would be to adjust request.SCRIPT_NAME, but how do I
do that every time the 'admin' route matches?)
What am I missing? There must be a simpler way.
Thanks for any pointers.
Jeff
--
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.