Ack! Sorry, I forgot about `config.scan('views')`. Thanks for correcting
me.
Another way of looking at the "route" vs "views" is this:
A route is essentially just a shorthand name for a url (which may contain
different patterns), and needs to be handled differently in multiple
contexts.
Let's say you have defined this simple "route":
config.add_route("splash", "/splash")
Or you define an advanced route that uses regex patterns:
config.add_route("splash_action", "/splash/{splash_action}")
You may want to register the route to multiple "views" depending on the
context, for example you can handle routes depending on the request method:
@view_config(route_name="splash", request_method="GET")
def handle_splash_get(...):
pass
@view_config(route_name="splash", request_method ="POST")
def handle_splash_post(...):
pass
If Pyramid didn't require named routes and instead supported URLs in the
view_config, it would be incredibly hard to manage your project as it grows
AND you would not be able to influence the order in which similar routes
are resolved.
So what might seem as a bit more work today, is actually not really much
work at all -- and it saves you a lot of time and energy tomorrow.
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.