Skip to content

Commit

Permalink
Removed unused Event import
Browse files Browse the repository at this point in the history
  • Loading branch information
Joel Collins committed Sep 9, 2020
1 parent eac0cea commit 160cbd8
Showing 1 changed file with 1 addition and 23 deletions.
24 changes: 1 addition & 23 deletions src/labthings/views/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

from ..actions.pool import Pool
from ..deque import Deque
from ..event import PropertyStatusEvent
from ..find import current_labthing
from ..marshalling import marshal_with, use_args
from ..representations import DEFAULT_REPRESENTATIONS
Expand Down Expand Up @@ -180,12 +179,6 @@ def dispatch_request(self, *args, **kwargs):
if self.default_stop_timeout is not None:
task.default_stop_timeout = self.default_stop_timeout

# Keep a copy of the raw, unmarshalled JSON input in the task
try:
task.input = request.json
except BadRequest:
task.input = None

# Wait up to 2 second for the action to complete or error
try:
task.get(block=True, timeout=self.wait_for)
Expand Down Expand Up @@ -239,22 +232,7 @@ def dispatch_request(self, *args, **kwargs):
meth = marshal_with(self.schema)(meth)

# Generate basic response
resp = self.represent_response(meth(*args, **kwargs))

# Emit property event
if request.method in ("POST", "PUT"):
property_value = self.get_value()
property_name = getattr(self, "endpoint", None) or getattr(
self, "__name__", "unknown"
)

if current_labthing():
current_labthing().message(
PropertyStatusEvent(property_name),
property_value,
)

return resp
return self.represent_response(meth(*args, **kwargs))


class EventView(View):
Expand Down

0 comments on commit 160cbd8

Please sign in to comment.