def get_unread_count(self, instance, read_at, action=None, target=None): if read_at: read_at = to_timestamp(read_at) key = self._make_key(instance, 'private', action=action, target=target) return self.client.zcount(key, read_at, to_timestamp(datetime.now()))
def get_unread_count(self, action=None, target=None): read_at = self.read_at or 0 if read_at: read_at = to_timestamp(read_at) key = self._make_key('private', action=action, target=target) return self.client.zcount(key, read_at, to_timestamp(datetime.now()))
def _save(self, action): result = { 'actor': app.backend.get_uid(action.actor), 'verb': action.verb, } timestamp = to_timestamp(action.date) result['timestamp'] = timestamp if action.target: result['target'] = app.backend.get_uid(action.target) uid = self.storage.make_uid(result) action.uid = uid action.timestamp = timestamp
def mark_as_read(self, timestamp=None): if timestamp is None: timestamp = datetime.now() self.client.set(self._get_read_key(), to_timestamp(timestamp))
def timestamp(self): return to_timestamp(self.date)
def mark_as_read(self, instance, timestamp): self.client.set(self.get_read_key(instance), to_timestamp(timestamp))