def checkfeedslist(self, fetchllimit, defDir, defStat, defDate, feedset, checknumber): delitems = 0 delitemi = 0 listits = FeedsList() fetchllimit = self.__checklimit(fetchllimit, listits.all().count(), checknumber) feeds = listits.all().filter('fetch_stat < ', 4).fetch(checknumber, fetchllimit) s = 0 i = 0 updated = [] logging.info('beging to check the feedslist for No %s to %s', fetchllimit, fetchllimit + checknumber) for feed in feeds: s += 1 result = self.__checklistnull(feed, s) if result != True: logging.info('delete the No. %s items', s) feed.delete() i += 1 # check the datetime of lists,and del the older else: result = self.__checkliststat(feed, s, defDate, defStat) if result != True: logging.info('delete the No. %s items', s) feed.delete() i += 1 else: result = self.__checklisterr(feed, s, defDir) if result != True: logging.info('delete the No. %s items', s) i += 1 feed.delete() #finished the feedslist check #db.put(feeds) logging.info('The totel items is %s,and we fixed the %s', s, i) delitems = s delitemi = i feedset.delitems = delitems feedset.delitemi = delitemi feedset.last_feedslist = fetchllimit + s feedset.put() return True
def changefeedstat(self, defDate, defStat, feedset, checknumber): i = 0 if defStat == True: feed_clean_date = datetime.now() - timedelta(days=14) listit = FeedsList() #TODO the fetch_stat=2,is mean the feeds maybe can try to seconds fetch,so we change the stat=0 feeds = listit.all().filter('date <', feed_clean_date).filter('fetch_stat = ', 2).fetch(int(checknumber)) logging.info('Start to change the feedslist stat') for feed in feeds: feed.fetch_stat = 0 i += 1 db.put(feeds) logging.info('finish!fixed %s', i) else: logging.info('nothing need to be change') feedset.chnitemi = i feedset.put()
def changefeedstat(self, defDate, defStat, feedset, checknumber): i = 0 if defStat == True: feed_clean_date = datetime.now() - timedelta(days=14) listit = FeedsList() #TODO the fetch_stat=2,is mean the feeds maybe can try to seconds fetch,so we change the stat=0 feeds = listit.all().filter('date <', feed_clean_date).filter( 'fetch_stat = ', 2).fetch(int(checknumber)) logging.info('Start to change the feedslist stat') for feed in feeds: feed.fetch_stat = 0 i += 1 db.put(feeds) logging.info('finish!fixed %s', i) else: logging.info('nothing need to be change') feedset.chnitemi = i feedset.put()
def getdb(self, checknumber, page=None, *arg1, **arg2): #for i in FeedsList.all(): # i.fetch_stat=1 # i.put() checknumber = checknumber listit = FeedsList.all().filter('fetch_stat = ', 1) feeds = listit.fetch(checknumber) i = 0 for feed in feeds: i += 1 logging.info('start to fetch article,The No %s', i) try: self.__store_article(feed) except Exception, data: logging.error('the error is %s ', data)
def getdb(self, checknumber, page=None, *arg1, **arg2): # for i in FeedsList.all(): # i.fetch_stat=1 # i.put() checknumber = checknumber listit = FeedsList.all().filter("fetch_stat = ", 1) feeds = listit.fetch(checknumber) i = 0 for feed in feeds: i += 1 logging.info("start to fetch article,The No %s", i) try: self.__store_article(feed) except Exception, data: logging.error("the error is %s ", data)
def __changstat(self, feedkey): listit = FeedsList.get(feedkey) listit.fetch_stat = 0 listit.put()
def get(self): listit = FeedList() feeds = listit.all() listits = FeedsList() self.getFeed()