Skip to content

Commit f363982

Browse files
author
Joel Collins
committed
Removed legacy property mode and raise invalid semtypes
1 parent d4fe57e commit f363982

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/labthings/server/view/builder.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ def property_of(
1616
description=None,
1717
semtype=None,
1818
schema=fields.Field(),
19-
_legacy=False, # Old structure where POST is used to write property
2019
):
2120

2221
# Create a class name
@@ -52,10 +51,6 @@ def _update(self, args):
5251
if type(getattr(property_object, property_name)) is dict:
5352
generated_class.put = _update
5453
generated_class.methods.add("PUT")
55-
# If legacy mode, use POST to write property
56-
elif _legacy:
57-
generated_class.post = _write
58-
generated_class.methods.add("POST")
5954
# Normally, use PUT to write property
6055
else:
6156
generated_class.put = _write
@@ -72,11 +67,11 @@ def _update(self, args):
7267
# Apply semantic type last, to ensure this is always used
7368
if semtype:
7469
if isinstance(semtype, str):
75-
generated_class = Semtype(semtype)(generated_class)
70+
generated_class.semtype = semtype
7671
elif isinstance(semtype, Semantic):
7772
generated_class = semtype(generated_class)
7873
else:
79-
logging.error(
74+
raise TypeError(
8075
"Unsupported type for semtype. Must be a string or Semantic object"
8176
)
8277
return generated_class
@@ -125,7 +120,7 @@ def _post_with_args(self, args):
125120
elif isinstance(semtype, Semantic):
126121
generated_class = semtype(generated_class)
127122
else:
128-
logging.error(
123+
raise TypeError(
129124
"Unsupported type for semtype. Must be a string or Semantic object"
130125
)
131126

0 commit comments

Comments
 (0)