Skip to content

Commit

Permalink
Fixed how _register_view looks for view tags
Browse files Browse the repository at this point in the history
  • Loading branch information
Joel Collins committed Jun 29, 2020
1 parent d7889d0 commit 82648f5
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/labthings/server/labthing.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,12 +323,13 @@ def _register_view(self, app, view, *urls, endpoint=None, **kwargs):
self.spec.path(**rule_to_apispec_path(flask_rule, view, self.spec))

# Handle resource groups listed in API spec
if "actions" in getattr(view, "tags", []):
self.thing_description.action(flask_rules, view)
self._action_views[view.endpoint] = view
if "properties" in getattr(view, "tags", []):
self.thing_description.property(flask_rules, view)
self._property_views[view.endpoint] = view
if hasattr(view, "get_tags"):
if "actions" in view.get_tags():
self.thing_description.action(flask_rules, view)
self._action_views[view.endpoint] = view
if "properties" in view.get_tags():
self.thing_description.property(flask_rules, view)
self._property_views[view.endpoint] = view

# Event stuff
def add_event(self, name, schema=None):
Expand Down

0 comments on commit 82648f5

Please sign in to comment.