mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-04-27 03:00:12 -04:00
View method to return columns sorted by timestamp.
This commit is contained in:
committed by
Neil Williams
parent
05f4028bce
commit
d9e9507b92
@@ -1272,6 +1272,14 @@ class View(ThingBase):
|
||||
# TODO: at present this only grabs max_column_count columns
|
||||
return self._t
|
||||
|
||||
@classmethod
|
||||
def get_time_sorted_columns(cls, rowkey, limit=None):
|
||||
q = cls._cf.xget(rowkey, include_timestamp=True)
|
||||
r = sorted(q, key=lambda i: i[1][1]) # (col_name, (col_val, timestamp))
|
||||
if limit:
|
||||
r = r[:limit]
|
||||
return OrderedDict([(i[0], i[1][0]) for i in r])
|
||||
|
||||
@classmethod
|
||||
@will_write
|
||||
def _set_values(cls, row_key, col_values,
|
||||
|
||||
Reference in New Issue
Block a user