diff --git a/ordr2/resources/__init__.py b/ordr2/resources/__init__.py index 8d0834b..5f19bdd 100644 --- a/ordr2/resources/__init__.py +++ b/ordr2/resources/__init__.py @@ -11,7 +11,7 @@ class Root(BaseResource): __name__ = None __parent__ = None - _nodes = { + nodes = { 'account': Account, 'admin': Admin } @@ -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): ''' diff --git a/ordr2/resources/base.py b/ordr2/resources/base.py index fb67aa2..75f488c 100644 --- a/ordr2/resources/base.py +++ b/ordr2/resources/base.py @@ -8,6 +8,7 @@ class BaseResource(object): request = None model = None + nodes = {} nav_highlight = None @@ -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)