Commits

Jesper Nøhr committed 3ed879b

removing initial call in init

  • Participants
  • Parent commits 512aa4a

Comments (0)

Files changed (2)

         return simplejson.loads(f.readline())
 
 class PuckClient(object):
-    def __init__(self, module, host, port, *args, **kwargs):
+    def __init__(self, host, port):
         for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM):
             af, socktype, proto, canonname, sa = res
             self.sock = socket.socket(af, socktype, proto)
             except socket.error, msg:
                 self.sock = None
             
-        if self.sock is not None:
-            self.state = self.__call(module, *args, **kwargs)
-        else:
-            print "failed to connect, can't do anything"
-    
-    def __call(self, module, *args, **kwargs):
-        return PuckShallowMethod(self.sock, module)(*args, **kwargs)
+        if self.sock is None:
+            print "can't connect"
     
     def __getattr__(self, attr):
         return PuckShallowMethod(self.sock, attr)

tests/example-fs/client.py

 from puck.client import PuckClient
 
 if __name__ == "__main__":
-    c = PuckClient("repository", 'localhost', 8080)
-    print c
+    c = PuckClient('localhost', 8080)
+    print c.repository('foo')