Browse Source

Simplified handler logic
The direct handler is always a coroutine, no need to perform this additional check.

Stan Janssen 4 years ago
parent
commit
3a176543fc
1 changed files with 1 additions and 5 deletions
  1. 1 5
      pyopenadr/service/vtn_service.py

+ 1 - 5
pyopenadr/service/vtn_service.py

@@ -33,11 +33,7 @@ class VTNService:
 
         if message_type in self.handlers:
             handler = self.handlers[message_type]
-            result = handler(message_payload)
-            if iscoroutine(result):
-                response_type, response_payload = await result
-            else:
-                response_type, response_payload = result
+            response_type, response_payload = await handler(message_payload)
 
             # Get the relevant template and create the XML response
             template = self.templates.get_template(f'{response_type}.xml')