fix: do not json dumps string into redis (avoiding escaping)

pull/9/head
Sami Mokaddem 2017-11-17 15:32:47 +01:00
parent 837c0e7a6d
commit b5a844dab8
1 changed files with 5 additions and 1 deletions

View File

@ -17,7 +17,11 @@ class Trendings_helper:
timestampDate = datetime.datetime.fromtimestamp(float(timestamp))
timestampDate_str = util.getDateStrFormat(timestampDate)
keyname = "{}:{}".format(trendingType, timestampDate_str)
self.serv_redis_db.zincrby(keyname, json.dumps(data), 1)
if isinstance(data, OrderedDict):
to_save = json.dumps(data)
else:
to_save = data
self.serv_redis_db.zincrby(keyname, to_save, 1)
def addTrendingEvent(self, eventName, timestamp):
self.addGenericTrending('TRENDINGS_EVENTS', eventName, timestamp)