diff --git a/ChangeLog b/ChangeLog index 33d8576..9622c9f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,6 @@ -2016.x.x, Version 2.x.x (BETA) +2016.10.27, Version 2.0.4 (BETA) - - Check for correct types using assert in query method. + - Fixed Python 2 to 3 compatibility 2016.10.26, Version 2.0.3 (BETA) diff --git a/setup.py b/setup.py index 098b61a..79ea5f3 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from distutils.core import setup import setuptools -VERSION = '2.0.3' +VERSION = '2.0.4' setup( name='siridb-connector-twisted', diff --git a/siridb/twisted/__init__.py b/siridb/twisted/__init__.py index aea320c..9e7cc2e 100644 --- a/siridb/twisted/__init__.py +++ b/siridb/twisted/__init__.py @@ -3,7 +3,7 @@ from .lib.client import SiriDBClientTwisted -__version_info__ = (2, 0, 3) +__version_info__ = (2, 0, 4) __version__ = '.'.join(map(str, __version_info__)) __maintainer__ = 'Jeroen van der Heijden' __email__ = 'jeroen@transceptor.technology' diff --git a/siridb/twisted/lib/client.py b/siridb/twisted/lib/client.py index 6df787a..649137e 100644 --- a/siridb/twisted/lib/client.py +++ b/siridb/twisted/lib/client.py @@ -1,3 +1,4 @@ +import sys import logging import random import time @@ -12,6 +13,8 @@ from .exceptions import PoolError from .exceptions import AuthenticationError +STRCMP = (str, bytes) if sys.version_info[0] == 3 else (str, unicode, bytes) + # never wait more than x seconds before trying to connect again DEFAULT_MAX_WAIT_RETRY = 90 @@ -132,7 +135,7 @@ def close(self): factory.connector.disconnect() @defer.inlineCallbacks - def insert(self, data, timeout=120): + def insert(self, data, timeout=300): '''Insert data into SiriDB. see module doc-string for info on exception handling. @@ -162,7 +165,7 @@ def query(self, query, timePrecision=None, timeout=60): see module doc-string for info on exception handling. ''' - assert isinstance(query, (str, unicode, bytes)), \ + assert isinstance(query, STRCMP), \ 'query should be of type str, unicode or bytes' assert timePrecision is None or isinstance(timePrecision, int), \