Skip to content

Commit 6c0460d

Browse files
authored
Simplified class attributes
1 parent 82124c9 commit 6c0460d

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/labthings/default_views/tasks.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@
99

1010
class TaskList(View):
1111
tags = ["tasks"]
12-
schema = TaskSchema(many=True)
1312

1413
def get(self):
1514
"""List of all session tasks"""
16-
return self.schema.dump(tasks.tasks())
15+
return TaskSchema(many=True).dump(tasks.tasks())
1716

1817

1918
class TaskView(View):
@@ -23,11 +22,7 @@ class TaskView(View):
2322
GET will safely return the current task progress.
2423
DELETE will terminate the background task, if running.
2524
"""
26-
2725
tags = ["tasks"]
28-
schema = TaskSchema()
29-
30-
marshal_methods = ("GET", "DELETE")
3126

3227
def get(self, task_id):
3328
"""
@@ -42,7 +37,7 @@ def get(self, task_id):
4237

4338
task = task_dict.get(task_id)
4439

45-
return self.schema.dump(task)
40+
return TaskSchema().dump(task)
4641

4742
def delete(self, task_id):
4843
"""
@@ -59,4 +54,4 @@ def delete(self, task_id):
5954

6055
task.kill(block=True, timeout=3)
6156

62-
return self.schema.dump(task)
57+
return TaskSchema().dump(task)

0 commit comments

Comments
 (0)