Earlier quoted context omitted.
Seems pretty defensive to me. How does, say, separating out the route and the view declarations help your application? Code like this: config = Configurator() config.add_route('hello', '/hello/{name}') config.add_view(hello_world, route_name='hello') is really just boilerplate, which is better done as a decorator. Count how many times the word 'hello' appears in that snippet above. And this is just for a hello world…
The ordering of your patterns matters, so that is done at config time. However it's very common to want to have unrelated code executed depending on the type of request to a URL. Pyramid will do this lookup for you, rather than polluting a gigantic view function with multiple code-paths for distinct functionality. @view_config(route_name='hello', request_method='GET') def get_hello(request): return Response('a GET re…
@route('/hello/:name', method='GET')
def hello_get(name):
return 'Hello %s' % name
@route('/hello/:name', method='POST')
def hello_post(name):
return 'Hello %s' % name
Pyramid permits a larger variety of predicates (including custom ones), however: https://docs.pylonsproject.org/projects/pyramid/1.2/narr/vie...