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
1.1 KiB
44 lines
1.1 KiB
''' Resources (sub) package, used to connect URLs to views ''' |
|
|
|
from pyramid.security import Allow, Everyone, DENY_ALL |
|
|
|
from .base import BaseResource |
|
from .account import AccountResource |
|
|
|
|
|
class RootResource(BaseResource): |
|
''' The root resource for the application |
|
|
|
:param request: |
|
the current request object |
|
:type request: |
|
pyramid.request.Request |
|
''' |
|
|
|
#: name of the main navigation section for template highlighting |
|
nav_section = 'root' |
|
|
|
#: dict to match the next url path segment |
|
nodes = { |
|
'account': AccountResource |
|
} |
|
|
|
def __init__(self, request): |
|
''' Create the root resource ''' |
|
self.__name__ = None |
|
self.__parent__ = None |
|
self.request = request |
|
|
|
def __acl__(self): |
|
''' access controll list for the resource ''' |
|
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(RootResource)
|
|
|