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.
33 lines
871 B
33 lines
871 B
7 years ago
|
''' Resources (sub) package, used to connect URLs to views '''
|
||
|
|
||
|
from pyramid.security import Allow, Everyone, DENY_ALL
|
||
|
|
||
|
|
||
|
class RootResource:
|
||
|
''' The root resource for the application
|
||
|
|
||
|
:param pyramid.request.Request request: the current request object
|
||
|
'''
|
||
|
|
||
|
def __init__(self, request):
|
||
|
''' Create the root resource
|
||
|
|
||
|
:param pyramid.request.Request request: the current request object
|
||
|
'''
|
||
|
self.__name__ = None
|
||
|
self.__parent__ = None
|
||
|
self.request = request
|
||
|
|
||
|
def __acl__(self):
|
||
|
''' access controll list for the resource '''
|
||
|
return [(Allow, Everyone, 'view'), DENY_ALL]
|
||
|
|
||
|
|
||
|
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)
|