Commits

Jesper Nøhr  committed 512aa4a

shaving down boilerplate in __call, using ShallowMethod

  • Participants
  • Parent commits 57e434f

Comments (0)

Files changed (1)

File puck/client.py

             'method': self.module, 
             'id': self.id,
             'args': self.args,
+            'kwargs': self.kwargs,
         }
 
         return simplejson.dumps(kwd)
             print "failed to connect, can't do anything"
     
     def __call(self, module, *args, **kwargs):
-        packet = JSONCall(module=module, id_=None, args=args, kwargs=kwargs)
-        self.sock.sendall(packet.to_json()+'\r\n')
-        f = self.sock.makefile('rb')
-        return simplejson.loads(f.readline())
+        return PuckShallowMethod(self.sock, module)(*args, **kwargs)
     
     def __getattr__(self, attr):
         return PuckShallowMethod(self.sock, attr)