def start(self): try: print 'starting timer' self.timer.start() except AttributeError: self.timer = RepeatTimer(300, self.fetch) print 'starting timer' self.start() self.fetch()
class RssProtocol(object): def __init__(self, myacct): self.myacct = myacct self.filter = RssFeedFilter(myacct.location) self.filter.bind('new_data', self.got_data) self.myacct.bind('enabled', self.start) self.myacct.bind('disabled', self.stop) def start(self): try: print 'starting timer' self.timer.start() except AttributeError: self.timer = RepeatTimer(300, self.fetch) print 'starting timer' self.start() self.fetch() def stop(self): try: print 'stopping timer' self.timer.stop() except AttributeError: pass @threaded def fetch(self): self.filter.update() self.myacct._dirty = True def got_data(self, items): self._dirty = True for item in items: print 'new rss item', item.title #------------------------------------------------- @property def count(self): return len(self.filter.items) @property def feed(self): return sorted(self.filter.items)
class RssProtocol(object): def __init__(self, myacct): self.myacct = myacct self.filter = RssFeedFilter(myacct.location) self.filter.bind('new_data', self.got_data) self.myacct.bind('enabled', self.start) self.myacct.bind('disabled', self.stop) def start(self): try: print 'starting timer' self.timer.start() except AttributeError: self.timer = RepeatTimer(300, self.fetch) print 'starting timer' self.start() self.fetch() def stop(self): try: print 'stopping timer' self.timer.stop() except AttributeError: pass @threaded def fetch(self): self.filter.update() self.myacct._dirty = True def got_data(self, items): self._dirty = True for item in items: print 'new rss item', item.title #------------------------------------------------- @property def count(self): return len(self.filter.items) @property def feed(self): return sorted(self.filter.items)
def start(self): try: print 'starting timer' self.timer.start() except AttributeError: self.timer = RepeatTimer(300, self.fetch) print 'starting timer' self.start() self.fetch()