Skip to content

Commit 80ef05b

Browse files
author
Joel Collins
committed
Removed marshal_task
1 parent 02e8773 commit 80ef05b

File tree

1 file changed

+0
-24
lines changed

1 file changed

+0
-24
lines changed

src/labthings/server/decorators.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -89,30 +89,6 @@ def wrapper(*args, **kwargs):
8989
return wrapper
9090

9191

92-
def marshal_task(f):
93-
"""Decorator to format the response of a View with the standard Task schema"""
94-
95-
logging.warning(
96-
"marshal_task is deprecated and will be removed in LabThings 1.0."
97-
"Please use the ActionView class instead."
98-
)
99-
100-
# Pass params to call function attribute for external access
101-
update_spec(f, {"responses": {201: {"description": "Task started successfully"}}})
102-
update_spec(f, {"_schema": {201: TaskSchema()}})
103-
# Wrapper function
104-
@wraps(f)
105-
def wrapper(*args, **kwargs):
106-
resp = f(*args, **kwargs)
107-
if not isinstance(resp, TaskThread):
108-
raise TypeError(
109-
f"Function {f.__name__} expected to return a TaskThread object, but instead returned a {type(resp).__name__}. If it does not return a task, remove the @marshall_task decorator from {f.__name__}."
110-
)
111-
return TaskSchema().dump(resp)
112-
113-
return wrapper
114-
115-
11692
def ThingAction(viewcls: View):
11793
"""Decorator to tag a view as a Thing Action
11894

0 commit comments

Comments
 (0)