|
|
|
@ -30,8 +30,13 @@ class BaseResource(object):
@@ -30,8 +30,13 @@ class BaseResource(object):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def __getitem__(self, key): |
|
|
|
|
klass = self.nodes[key] |
|
|
|
|
return klass(key, self) |
|
|
|
|
klass = self.nodes.get(key, None) |
|
|
|
|
if klass: |
|
|
|
|
return klass(key, self) |
|
|
|
|
try: |
|
|
|
|
return super().__getitem__(key) |
|
|
|
|
except AttributeError: |
|
|
|
|
raise KeyError() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@classmethod |
|
|
|
@ -210,3 +215,10 @@ class PaginationResourceMixin(object):
@@ -210,3 +215,10 @@ class PaginationResourceMixin(object):
|
|
|
|
|
params = self.query_params(*args, **kwargs) |
|
|
|
|
return self.request.resource_url(self, query=params) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def __getitem__(self, key): |
|
|
|
|
model = self.request.dbsession.query(self.sql_model_class).get(key) |
|
|
|
|
if not model: |
|
|
|
|
raise KeyError() |
|
|
|
|
return self.child_resource_class.from_sqla(model, self) |
|
|
|
|
|
|
|
|
|