Skip to content

Commit c705d50

Browse files
author
Joel Collins
committed
Merge remote-tracking branch 'origin/master' into gevent-pool
2 parents 217b87e + c94c57d commit c705d50

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ share/python-wheels/
2626
.installed.cfg
2727
*.egg
2828
MANIFEST
29+
# We use poetry, so should ignore the generated setup.py
30+
/setup.py
2931

3032
# PyInstaller
3133
# Usually these files are written by a python script from a template

labthings/server/spec/td.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,15 @@ def property(self, rules: list, view: View):
212212
self.properties[key] = self.view_to_thing_property(rules, view)
213213

214214
def action(self, rules: list, view: View):
215+
"""Add a view representing an Action.
216+
217+
NB at present this will fail for any view that doesn't support POST
218+
requests.
219+
"""
220+
if not hasattr(view, "post"):
221+
raise AttributeError(
222+
f"The API View '{view}' was added as an Action, but it does not have a POST method."
223+
)
215224
endpoint = getattr(view, "endpoint") or getattr(rules[0], "endpoint")
216225
key = snake_to_camel(endpoint)
217226
self.actions[key] = self.view_to_thing_action(rules, view)

0 commit comments

Comments
 (0)