Browse Source

moved child nodes to base resource class

php2python
Holger Frey 7 years ago
parent
commit
149dfbc19e
  1. 6
      ordr2/resources/__init__.py
  2. 5
      ordr2/resources/base.py

6
ordr2/resources/__init__.py

@ -11,7 +11,7 @@ class Root(BaseResource): @@ -11,7 +11,7 @@ class Root(BaseResource):
__name__ = None
__parent__ = None
_nodes = {
nodes = {
'account': Account,
'admin': Admin
}
@ -22,10 +22,6 @@ class Root(BaseResource): @@ -22,10 +22,6 @@ class Root(BaseResource):
def __acl__(self):
return [ (Allow, Everyone, 'view') ]
def __getitem__(self, key):
klass = self._nodes[key]
return klass(key, self)
def includeme(config):
'''

5
ordr2/resources/base.py

@ -8,6 +8,7 @@ class BaseResource(object): @@ -8,6 +8,7 @@ class BaseResource(object):
request = None
model = None
nodes = {}
nav_highlight = None
@ -18,3 +19,7 @@ class BaseResource(object): @@ -18,3 +19,7 @@ class BaseResource(object):
def __acl__(self):
return [ DENY_ALL ]
def __getitem__(self, key):
klass = self.nodes[key]
return klass(key, self)