I've been playing with Pyramid recently and, based on the Pylons background, I focused on URL routing, not on crawl.
I also consider using handlers to group specific controller functions into one class. Instead of having view.py polluted with a bunch of functions.
Config:
config.add_handler('view_page', '/page/view/{id}', handler=Page, action=view_page)
Handler:
from pyramid.response import Response from pyramid.view import action class Page(object): def __init__(self, request): self.request = request def view_page(self): return {'id': id}
I read the docs earlier today about the implicit declaration of an action in the add_handler () call, so that might be wrong ... However, my main problem is accessing the id in view_callable
How do I get the "id"?
source share