def load(self, path='feeds.dat'): logging.info('Loading feed data from "%s"' % path) try: data = safe_pickle.load(path) except Exception: data = ([], [], []) # backward compatibility if len(data) == 2: self.feeds, self.items = data self.filters = [] else: self.feeds, self.items, self.filters = data attributes = { 'clicks': 0, 'item_count': 0, 'username': None, 'password': None, 'color': None, } for feed in self.feeds: for name, value in attributes.items(): if not hasattr(feed, name): setattr(feed, name, value) if not hasattr(feed, 'id_list'): feed.id_list = list(feed.id_set) logging.info('Loaded %d feeds, %d items, %d filters' % (len(self.feeds), len(self.items), len(self.filters)))
def load(self, path='feeds.dat'): logging.info('Loading feed data from "%s"' % path) try: data = safe_pickle.load(path) except Exception: data = ([], [], []) # backward compatibility if len(data) == 2: self.feeds, self.items = data self.filters = [] else: self.feeds, self.items, self.filters = data attributes = { 'clicks': 0, 'item_count': 0, 'username': None, 'password': None, 'color': None, } for feed in self.feeds: for name, value in attributes.iteritems(): if not hasattr(feed, name): setattr(feed, name, value) if not hasattr(feed, 'id_list'): feed.id_list = list(feed.id_set) logging.info('Loaded %d feeds, %d items, %d filters' % (len(self.feeds), len(self.items), len(self.filters)))
def load(self): """[summary] """ try: self._settings = safe_pickle.load(self._file) except Exception: self._settings = {}
def load(self): try: self._settings = safe_pickle.load(self._file) except Exception: self._settings = {}