class CFeed(Persistent): def __init__(self, urlfeed): self.url = urlfeed self.title = '' self.link = '' self.last_items = PersistentList() # last 50, for example, only hash self.users = PersistentSet() # CUser set def add_user(self, useritem): if not self.has_jid(useritem): self.users.add(useritem) return True return False def del_user(self, useritem): if self.has_jid(useritem): self.users.remove(useritem) return True return False def has_jid(self, useritem): """Search the user jid in 'users' set""" for x in self.users: if x.jid == useritem.jid: return True return False
def __init__(self, urlfeed): self.url = urlfeed self.title = '' self.link = '' self.last_items = PersistentList() # last 50, for example, only hash self.users = PersistentSet() # CUser set