Ejemplo n.º 1
0
 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)))
Ejemplo n.º 2
0
 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)))
Ejemplo n.º 3
0
    def load(self):
        """[summary]
        """

        try:
            self._settings = safe_pickle.load(self._file)
        except Exception:
            self._settings = {}
Ejemplo n.º 4
0
 def load(self):
     try:
         self._settings = safe_pickle.load(self._file)
     except Exception:
         self._settings = {}
Ejemplo n.º 5
0
 def load(self):
     try:
         self._settings = safe_pickle.load(self._file)
     except Exception:
         self._settings = {}