From 897c90621a7cb85545864df9fd56c607dcef5585 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 17 Aug 2016 09:05:14 +0200 Subject: fixs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/libcoopgamma.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/libcoopgamma.py') diff --git a/src/libcoopgamma.py b/src/libcoopgamma.py index c75ed04..ee0ec63 100644 --- a/src/libcoopgamma.py +++ b/src/libcoopgamma.py @@ -720,7 +720,7 @@ class Context: params = (self.fd, data) return 'libcoopgamma.Context(%s)' % ', '.join(repr(p) for p in params) - def connect(self, method, site): + def connect(self, method = None, site = None): ''' Connect to a coopgamma server, and start it if necessary @@ -736,12 +736,13 @@ class Context: ''' if method is not None and isinstance(method, int): method = str(method) - error = llibcoopgamma_native.ibcoopgamma_native_connect(method, site, self.address) - if error is not None: - if error == 0: + (successful, value) = libcoopgamma_native.libcoopgamma_native_connect(method, site, self.address) + if not successful: + if value == 0: raise ServerInitialisationError() else: - raise ErrorReport.create_error(error) + raise ErrorReport.create_error(value) + self.fd = value def detach(self): ''' -- cgit v1.2.3-70-g09d2