def __init__(self): usys = UpdateSys() if usys.get_update_rankno() == 0: rankclass = BookRankingTable0 elif usys.get_update_rankno() == 1: rankclass = BookRankingTable1 else: raise Exception('Invalid rankno. rankno:%s' % usys.get_update_rankno()) self._klass = rankclass
def __init__(self): usys = UpdateSys() if usys.get_rankno() == 0: rankclass = BookRankingTable0 elif usys.get_rankno() == 1: rankclass = BookRankingTable1 else: raise Exception('Invalid rankno. rankno:%s' % usys.get_rankno()) self._klass = rankclass self._entries = [] self._entry_id = 0 self._total_num = None self._page = 1 self._limit = 10 self._book_entry = None
def __cmp__(self, other): if self.include_keywords == other.include_keywords: self_point = self.hateb + self.rt + self.like other_point = other.hateb + other.rt + other.like if self_point == other_point: return cmp(self.salesrank, other.salesrank) else: return cmp(self_point, other_point) return cmp(self.include_keywords, other.include_keywords) def __repr__(self): return '<title:%s img:%s url:%s baseurl:%s hateb:%s>' % (self.title, self.img, self.url, self.baseurl, self.hateb) # main usys = UpdateSys() if not usys.run_update(): print 'already running.' sys.exit() # Truncate bookrank = BookRankingUpdater() bookrank.truncate() # Update for e in BookEntryUpdater.get_all(): entry_id = e.id opt = {} opt['Keywords'] = e.term opt['SearchIndex'] = e.searchindex if e.node: