Merge "api: Keep track of action controllers"
This commit is contained in:
commit
07f05add31
|
@ -94,7 +94,7 @@ def _create_controller(main_controller, action_controller_list):
|
|||
|
||||
controller = wsgi.Resource(main_controller())
|
||||
for ctl in action_controller_list:
|
||||
controller.register_actions(ctl())
|
||||
controller.register_subcontroller_actions(ctl())
|
||||
return controller
|
||||
|
||||
|
||||
|
|
|
@ -396,8 +396,8 @@ class Resource(wsgi.Application):
|
|||
""":param controller: object that implement methods created by routes
|
||||
lib
|
||||
"""
|
||||
|
||||
self.controller = controller
|
||||
self.sub_controllers = []
|
||||
|
||||
self.default_serializers = dict(json=JSONDictSerializer)
|
||||
|
||||
|
@ -413,6 +413,13 @@ class Resource(wsgi.Application):
|
|||
for key, method_name in actions.items():
|
||||
self.wsgi_actions[key] = getattr(controller, method_name)
|
||||
|
||||
def register_subcontroller_actions(self, sub_controller):
|
||||
"""Registers sub-controller actions with this resource."""
|
||||
self.sub_controllers.append(sub_controller)
|
||||
actions = getattr(sub_controller, 'wsgi_actions', {})
|
||||
for key, method_name in actions.items():
|
||||
self.wsgi_actions[key] = getattr(sub_controller, method_name)
|
||||
|
||||
def get_action_args(self, request_environment):
|
||||
"""Parse dictionary created by routes library."""
|
||||
|
||||
|
|
Loading…
Reference in New Issue