You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
914 B
44 lines
914 B
''' base resource and resource root factory ''' |
|
|
|
from pyramid.security import Allow, Everyone |
|
|
|
from .account import Account, PasswordResetAccount |
|
from .admin import ( |
|
Admin, |
|
ConsumableList, |
|
ConsumableResource, |
|
UserList, |
|
UserAccount |
|
) |
|
from .base import BaseResource |
|
from .orders import OrderList, OrderResource |
|
|
|
|
|
class Root(BaseResource): |
|
''' Root resource ''' |
|
|
|
__name__ = None |
|
__parent__ = None |
|
|
|
nodes = { |
|
'account': Account, |
|
'admin': Admin, |
|
'orders': OrderList |
|
} |
|
|
|
def __init__(self, request): |
|
self.request = request |
|
|
|
def __acl__(self): |
|
''' access controll list ''' |
|
return [ (Allow, Everyone, 'view') ] |
|
|
|
|
|
def includeme(config): |
|
''' |
|
Initialize the resources for traversal in a Pyramid app. |
|
|
|
Activate this setup using ``config.include('ordr2.resources')``. |
|
|
|
''' |
|
config.set_root_factory(Root)
|
|
|