Revision: 1e753312dfbf
Author:   paul cannon <[email protected]>
Date:     Sat Sep  8 21:30:43 2012
Log:      Support ReversedType

that is, be able to serde values reported as having this type, by simply
using the subtype.

http://code.google.com/a/apache-extras.org/p/cassandra-dbapi2/source/detail?r=1e753312dfbf

Modified:
 /cql/cqltypes.py

=======================================
--- /cql/cqltypes.py    Sat Sep  8 20:00:13 2012
+++ /cql/cqltypes.py    Sat Sep  8 21:30:43 2012
@@ -622,6 +622,20 @@
     typename = "'org.apache.cassandra.db.marshal.ColumnToCollectionType'"
     num_subtypes = 1

+class ReversedType(_ParameterizedType):
+    typename = "'org.apache.cassandra.db.marshal.ReversedType'"
+    num_subtypes = 1
+
+    @classmethod
+    def deserialize_safe(cls, byts):
+        subtype, = cls.subtypes
+        return subtype.from_binary(byts)
+
+    @classmethod
+    def serialize_safe(cls, val):
+        subtype, = cls.subtypes
+        return subtype.to_binary(val)
+
 def is_counter_type(t):
     if isinstance(t, basestring):
         t = lookup_casstype(t)

Reply via email to