view backend/sqlalchemy/Preference.py @ 192:9d422fa90096

optimize marking feed entries as read: do not round trip to the database if the entry was already marked as read
author dirk
date Wed, 21 Sep 2011 13:23:25 +0200
parents 04a730f9d07d
children bb3c851b18b1
line wrap: on
line source


class Preference(object):
    @staticmethod
    def forKey(key, session):
        return session.query(Preference).filter(Preference.key == key).first()
    
    def __init__(self, key, value):
        self.key = key
        self.value = value
    
    def __repr__(self):
        return "<Preference %s = %s>" % (self.key, self.value)