Permalink
Browse files

Remove API version check on Connection init

  • Loading branch information...
thobbs committed Jul 17, 2012
1 parent 194a195 commit c95d873407a0a47ac4d26027d29dd9367b5328b4
Showing with 1 addition and 31 deletions.
  1. +1 −26 pycassa/connection.py
  2. +0 −5 pycassa/util.py
View
@@ -3,18 +3,11 @@
from thrift.protocol import TBinaryProtocol
from pycassa.cassandra.c11 import Cassandra
-from pycassa.cassandra.constants import (CASSANDRA_07, CASSANDRA_08,
- CASSANDRA_10, CASSANDRA_11)
from pycassa.cassandra.ttypes import AuthenticationRequest
-from pycassa.util import compatible
DEFAULT_SERVER = 'localhost:9160'
DEFAULT_PORT = 9160
-LOWEST_COMPATIBLE_VERSION = 17
-
-class ApiMismatch(Exception): pass
-
class Connection(Cassandra.Client):
"""Encapsulation of a client session."""
@@ -30,7 +23,7 @@ def __init__(self, keyspace, server, framed_transport=True, timeout=None,
host = server[0]
socket = TSocket.TSocket(host, int(port))
if timeout is not None:
- socket.setTimeout(timeout*1000.0)
+ socket.setTimeout(timeout * 1000.0)
if framed_transport:
self.transport = TTransport.TFramedTransport(socket)
else:
@@ -39,24 +32,6 @@ def __init__(self, keyspace, server, framed_transport=True, timeout=None,
Cassandra.Client.__init__(self, protocol)
self.transport.open()
- if api_version is None:
- server_api_version = self.describe_version()
- if compatible(CASSANDRA_11, server_api_version):
- self.version = CASSANDRA_11
- elif compatible(CASSANDRA_10, server_api_version):
- self.version = CASSANDRA_10
- elif compatible(CASSANDRA_08, server_api_version):
- self.version = CASSANDRA_08
- elif compatible(CASSANDRA_07, server_api_version):
- self.version = CASSANDRA_07
- else:
- raise ApiMismatch("Thrift API version incompatibility: " \
- "server version %s is not Cassandra 0.7, " \
- "0.8, 1.0 or 1.1" %
- (server_api_version))
- else:
- self.version = api_version
-
self.set_keyspace(keyspace)
if credentials is not None:
View
@@ -344,8 +344,3 @@ def __eq__(self, other):
def __ne__(self, other):
return not self == other
-
-def compatible(v1, v2):
- v1 = map(int, v1.split('.', 2)[:2])
- v2 = map(int, v2.split('.', 2)[:2])
- return v1[0] == v2[0] and v1[1] <= v2[1]

0 comments on commit c95d873

Please sign in to comment.