@@ -113,20 +113,20 @@ class PropertyView(View):
113113 __apispec__ = {"tags" : {"properties" }}
114114
115115 def dispatch_request (self , * args , ** kwargs ):
116- if request .method == "GET" :
117- return View .dispatch_request (self , * args , ** kwargs )
116+ if request .method in ("POST" , "PUT" , "DELETE" , "PATCH" ):
117+ # FIXME: Sketchy as this breaks if the response is a generator/loop
118+ resp = View .dispatch_request (self , * args , ** kwargs )
118119
119- # FIXME: Sketchy as this breaks if the response is a generator/loop
120- resp = View .dispatch_request (self , * args , ** kwargs )
120+ property_value = self .get_value ()
121+ property_name = getattr (self , "endpoint" , None ) or getattr (
122+ self , "__name__" , "unknown"
123+ )
121124
122- property_value = self . get_value ()
123- property_name = getattr ( self , "endpoint" , None ) or getattr (
124- self , "__name__" , "unknown"
125- )
125+ if current_labthing ():
126+ current_labthing (). message (
127+ PropertyStatusEvent ( property_name ), property_value ,
128+ )
126129
127- if current_labthing ():
128- current_labthing ().message (
129- PropertyStatusEvent (property_name ), property_value ,
130- )
130+ return resp
131131
132- return resp
132+ return View . dispatch_request ( self , * args , ** kwargs )
0 commit comments