Browse Source

small bugfix and code improvement

digital 7 years ago
parent
commit
3b1811a327
1 changed files with 4 additions and 8 deletions
  1. 4 8
      lib/beewatch/server/__init__.py

+ 4 - 8
lib/beewatch/server/__init__.py

@@ -68,16 +68,12 @@ class ConnHandlerBeeWatch(digilib.network.ConnHandlerBase):
             "turn":self.engines_ctrl.turn
         }
 
-    def handle(self, data_decoded):
+    def handle(self, data):
         data_decoded=data_decoded.strip()
         # lchat.info("Client:"+data_decoded)
-        if data_decoded.find(" ") != -1:
-            cmd = data_decoded.split()[0]
-            args = data_decoded.split()[1:]
-        else:
-            cmd=data_decoded
-            args = ()
-        kwargs = {"args":args,"command":command,"respond":self.respond}
+        data = data.split(" ")
+        cmd,*args = data
+        kwargs = {"args":args,"command":cmd,"respond":self.respond}
         func = beewatch._commands.get(name,False)
         if func == False:
             self.respond("Unknown command")