From 59d8c68e949aa7b84f408f27078860c98d577704 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Sat, 9 Mar 2013 00:21:28 -0800 Subject: [PATCH] Add Cassandra thing _date property for use by JSON templates. Cassandra things name their date property "date", while tdb_sql things name it "_date". This property alias allows the existing JSON template code to access the timestamp without caring about what type of thing it is. --- r2/r2/lib/db/tdb_cassandra.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/r2/r2/lib/db/tdb_cassandra.py b/r2/r2/lib/db/tdb_cassandra.py index 35fc4141a..1793cefcf 100644 --- a/r2/r2/lib/db/tdb_cassandra.py +++ b/r2/r2/lib/db/tdb_cassandra.py @@ -790,6 +790,11 @@ class ThingBase(object): class Thing(ThingBase): _timestamp_prop = 'date' + # alias _date property for consistency with tdb_sql things. + @property + def _date(self): + return self.date + class UuidThing(ThingBase): _timestamp_prop = 'date' _extra_schema_creation_args = {