diff options
-rw-r--r-- | CHANGES | 2 | ||||
-rw-r--r-- | redis/connection.py | 8 |
2 files changed, 9 insertions, 1 deletions
@@ -1,3 +1,5 @@ +* 2.2.5 (in development) + * Support Jython, fixing #97. * 2.2.4 * WARNING: Potential backwards incompatible change - Changed order of parameters of ZREVRANGEBYSCORE to match those of the actual Redis command. diff --git a/redis/connection.py b/redis/connection.py index 9bacb53..5839ebc 100644 --- a/redis/connection.py +++ b/redis/connection.py @@ -3,6 +3,12 @@ import socket import threading from redis.exceptions import ConnectionError, ResponseError, InvalidResponse +# Jython doesn't define socket.SOL_TCP, but works fine with it's value, 6 +try: + SOL_TCP = socket.SOL_TCP +except AttributeError: + SOL_TCP = 6 + class BaseConnection(object): "Manages TCP communication to and from a Redis server" def __init__(self, host='localhost', port=6379, db=0, password=None, @@ -33,7 +39,7 @@ class BaseConnection(object): error_message = "Error %s connecting %s:%s. %s." % \ (e.args[0], self.host, self.port, e.args[1]) raise ConnectionError(error_message) - sock.setsockopt(socket.SOL_TCP, socket.TCP_NODELAY, 1) + sock.setsockopt(SOL_TCP, socket.TCP_NODELAY, 1) self._sock = sock self._fp = sock.makefile('r') redis_instance._setup_connection() |