cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1095205 - in /cassandra/branches/cassandra-0.8/drivers/py/cql: __init__.py connection.py marshal.py
Date Tue, 19 Apr 2011 20:39:46 GMT
Author: jbellis
Date: Tue Apr 19 20:39:46 2011
New Revision: 1095205

URL: http://svn.apache.org/viewvc?rev=1095205&view=rev
Log:
fix imports in python cql driver
patch by jbellis; reviewed by thobbs for CASSANDRA-2508

Modified:
    cassandra/branches/cassandra-0.8/drivers/py/cql/__init__.py
    cassandra/branches/cassandra-0.8/drivers/py/cql/connection.py
    cassandra/branches/cassandra-0.8/drivers/py/cql/marshal.py

Modified: cassandra/branches/cassandra-0.8/drivers/py/cql/__init__.py
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/drivers/py/cql/__init__.py?rev=1095205&r1=1095204&r2=1095205&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/drivers/py/cql/__init__.py (original)
+++ cassandra/branches/cassandra-0.8/drivers/py/cql/__init__.py Tue Apr 19 20:39:46 2011
@@ -17,6 +17,7 @@
 
 import exceptions
 import datetime
+import time
 
 import connection
 import marshal

Modified: cassandra/branches/cassandra-0.8/drivers/py/cql/connection.py
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/drivers/py/cql/connection.py?rev=1095205&r1=1095204&r2=1095205&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/drivers/py/cql/connection.py (original)
+++ cassandra/branches/cassandra-0.8/drivers/py/cql/connection.py Tue Apr 19 20:39:46 2011
@@ -19,6 +19,7 @@ from cursor import Cursor
 from cassandra import Cassandra
 from thrift.transport import TTransport, TSocket
 from thrift.protocol import TBinaryProtocol
+from cql.cassandra.ttypes import AuthenticationRequest
 
 
 class Connection(object):
@@ -62,7 +63,7 @@ class Connection(object):
 
     def close(self):
         if not self.open_socket:
-            raise InternalError("Connection has been closed.")
+            return
 
         self.transport.close()
         self.open_socket = False
@@ -75,9 +76,11 @@ class Connection(object):
         return
 
     def rollback(self):
+        from cql import NotSupportedError
         raise NotSupportedError("Rollback functionality not present in Cassandra.")
 
     def cursor(self):
+        from cql import ProgrammingError
         if not self.open_socket:
-            raise InternalError("Connection has been closed.")
+            raise ProgrammingError("Connection has been closed.")
         return Cursor(self)

Modified: cassandra/branches/cassandra-0.8/drivers/py/cql/marshal.py
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/drivers/py/cql/marshal.py?rev=1095205&r1=1095204&r2=1095205&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/drivers/py/cql/marshal.py (original)
+++ cassandra/branches/cassandra-0.8/drivers/py/cql/marshal.py Tue Apr 19 20:39:46 2011
@@ -66,11 +66,12 @@ def unmarshal_utf8(bytestr):
 def unmarshal_int(bytestr):
     return decode_bigint(bytestr)
 
-def unmarshal_long(bytestr):
-    if _have_struct:
+if _have_struct:
+    def unmarshal_long(bytestr):
         return _long_packer.unpack(bytestr)[0]
-    else:
-        return unpack(">q", bytestr)[0]
+else:
+    def unmarshal_long(bytestr):
+        return struct.unpack(">q", bytestr)[0]
 
 def unmarshal_uuid(bytestr):
     return UUID(bytes=bytestr)



Mime
View raw message