def store_pending_tweet(self, title, link, tags, view_count, pos): pt = PendingTweet(title=title, link=link, tags=tags, viewCount=view_count, rank=pos) pt.put() logger.info("Adding a PendingTweet (%s) " % pt) return 1
def store_pending_tweets(self, query_results): logger.debug('attempting to store pending tweets') if len(query_results.get('rows', [])) > 0: db.delete(PendingTweet.all()) # clear all the pending tweets logger.debug("cleared all pending tweets") pos = 1 for row in query_results.get('rows'): logger.debug( '\t'.join(row) ) title_and_link = row[0] firstPart = title_and_link.index("|") title = self.parse_string(title_and_link[0:firstPart]) logger.info(title) link = title_and_link[firstPart+1:] tags = row[1] view_count = long(row[2]) pos += self.store_pending_tweet(title, link, tags, view_count, pos)
def store_pending_tweets(self, query_results): logger.debug('attempting to store pending tweets') if len(query_results.get('rows', [])) > 0: db.delete(PendingTweet.all()) # clear all the pending tweets logger.debug("cleared all pending tweets") pos = 1 for row in query_results.get('rows'): logger.debug('\t'.join(row)) title_and_link = row[0] firstPart = title_and_link.index("|") title = self.parse_string(title_and_link[0:firstPart]) logger.info(title) link = title_and_link[firstPart + 1:] tags = row[1] view_count = long(row[2]) pos += self.store_pending_tweet(title, link, tags, view_count, pos)