pyramid_duh.route module¶
Utilities for traversal
-
class
pyramid_duh.route.
IModelResource
(model=None)[source]¶ Bases:
pyramid_duh.route.ISmartLookupResource
Resource base class for wrapping models in a sqlalchemy database
Notes
Requires any parent node to set the ‘request’ attribute
-
class
pyramid_duh.route.
ISmartLookupResource
[source]¶ Bases:
object
Resource base class that allows hierarchical lookup of attributes
Potential use case: /user/1234/post/5678
At the /user/1234 point in traversal you can set a ‘user’ attribute on the resource. At the ‘post/5678’ point in traversal you can set a ‘post’ attribute on that resource. Then the request can access both of them from the context directly:
def get_user_post(context, request): user = context.user if user.is_cool(): return context.post
-
class
pyramid_duh.route.
IStaticResource
[source]¶ Bases:
pyramid_duh.route.ISmartLookupResource
Simple resource base class for static-mapping of paths