On Sat, Oct 5, 2013 at 12:00 AM, Harvey Smith <hlwsm...@gmail.com> wrote: > Currently in Pyramid v1.5a2 one cannot easily loop over a list of routes to > generate the URLs (for example to generate a nav menu) if some of the routes > are external and one wished to use URL paths instead of qualified URLs > (easier to server through proxies.) This is because Request.route_path() > will raise an exception when called with an external route. > > Since external routes must contain the qualified URL by definition, it would > be more convenient if Request.route_path() just returned the qualified URL > instead of an exception in these cases. In other words Request.route_path() > should prefer to return URL paths when possible, but not bail out when it's > not. > > Or will this cause some evil side effects I am missing?
That could go either way. I normally use route_path() but if I were generating an external URL I'd probably call route_url() to make it clear. On the other hand, I don't see anything wrong with route_path() returning a fully-qualified external URL because an unqualified URL is meaningless in that case. I'm not sure if we should support looping through routes though; that sounds fragile. You'd have to know something about the routes to know if each one was suitable for the menu, and if the routes require parameters you wouldn't be able to generate them without the parameters. -- You received this message because you are subscribed to the Google Groups "pylons-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to pylons-devel+unsubscr...@googlegroups.com. To post to this group, send email to pylons-devel@googlegroups.com. Visit this group at http://groups.google.com/group/pylons-devel. For more options, visit https://groups.google.com/groups/opt_out.