view backend/arangodb/FeedEntry.py @ 256:f79be01821c4

Arangodb backend, first version which barely works for reading
author Dirk Olmes <dirk@xanthippe.ping.de>
date Wed, 30 Jan 2019 07:11:10 +0100
parents
children 304917762618
line wrap: on
line source

# -*- coding: utf-8 -*-
from datetime import datetime

class FeedEntry(object):
    def __init__(self, document):
        super(FeedEntry, self).__init__()
        self.document = document

    def __getattr__(self, attribute):
        if attribute == 'updated':
            return self._parse_updated()
        return self.document[attribute]

    def _parse_updated(self):
        value = self.document['updated']
        return datetime(*value)

    def markRead(self):
        self.document['read'] = True
        self.document.patch()