view FeedEntry.py @ 41:9fa1e33b67da

use Qt resources for window icons
author Dirk Olmes <dirk@xanthippe.ping.de>
date Fri, 14 May 2010 08:04:54 +0200
parents f371d02fa09d
children daa2731967fe
line wrap: on
line source


from datetime import datetime

def compareByUpdateDate(first, second):
    return cmp(first.updated, second.updated)

class FeedEntry(object):
    @staticmethod
    def findById(id, session):
        result = session.query(FeedEntry).filter(FeedEntry.id == id)
        return result.first()

    def __init__(self):
        self.create_timestamp = datetime.now()
        self.read = 0

    def __repr__(self):
        return "<FeedEntry (%d) %s>" % (self.pk, self.title)

    def userPresentableString(self):
        return self.title
    
    def toggleRead(self):
        if self.read:
            self.read = 0
        else:
            self.read = 1