Holger Frey
7 years ago
2 changed files with 34 additions and 5 deletions
@ -0,0 +1,33 @@
@@ -0,0 +1,33 @@
|
||||
''' 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) |
Reference in new issue