def get(self, direction = 'next', page = '2', base_id = '1'): if page == '1': self.redirect(BASE_URL) return objs = Article.get_page_posts(direction, page, base_id) if objs: if direction == 'prev': objs.reverse() fromid = objs[0].id endid = objs[-1].id else: fromid = endid = '' allpost = Article.count_all_post() allpage = allpost/EACH_PAGE_POST_NUM if allpost%EACH_PAGE_POST_NUM: allpage += 1 output = self.render('index.html', { 'title': "%s - %s | Part %s"%(SITE_TITLE,SITE_SUB_TITLE, page), 'keywords':KEYWORDS, 'description':SITE_DECR, 'objs': objs, 'cats': Category.get_all_cat_name(), 'tags': Tag.get_hot_tag_name(), 'page': int(page), 'allpage': allpage, 'listtype': 'index', 'fromid': fromid, 'endid': endid, 'comments': Comment.get_recent_comments(), 'links':Link.get_all_links(), },layout='_layout.html') self.write(output) return output
def get(self): try: objs = Article.get_post_for_homepage() except: self.redirect('/install') return if objs: fromid = objs[0].id endid = objs[-1].id else: fromid = endid = '' allpost = Article.count_all_post() allpage = allpost / EACH_PAGE_POST_NUM if allpost % EACH_PAGE_POST_NUM: allpage += 1 output = self.render('index.html', { 'title': "%s - %s" % (SITE_TITLE, SITE_SUB_TITLE), 'keywords': KEYWORDS, 'description': SITE_DECR, 'objs': objs, 'cats': Category.get_all_cat_name(), 'tags': Tag.get_hot_tag_name(), 'page': 1, 'allpage': allpage, 'listtype': 'index', 'fromid': fromid, 'endid': endid, 'comments': Comment.get_recent_comments(), 'links': Link.get_all_links(), }, layout='_layout.html') self.write(output) return output
def get(self): try: objs = Article.get_post_for_homepage() except: self.redirect('/install') return if objs: fromid = objs[0].id endid = objs[-1].id else: fromid = endid = '' allpost = Article.count_all_post() allpage = allpost/EACH_PAGE_POST_NUM if allpost%EACH_PAGE_POST_NUM: allpage += 1 output = self.render('index.html', { 'title': "%s - %s"%(SITE_TITLE,SITE_SUB_TITLE), 'keywords':KEYWORDS, 'description':SITE_DECR, 'objs': objs, 'cats': Category.get_all_cat_name(), 'tags': Tag.get_hot_tag_name(), 'page': 1, 'allpage': allpage, 'listtype': 'index', 'fromid': fromid, 'endid': endid, 'comments': Comment.get_recent_comments(), 'links':Link.get_all_links(), },layout='_layout.html') self.write(output) return output
def get(self, direction='next', page='2', base_id='1'): if page == '1': self.redirect(BASE_URL) return objs = Article.get_page_posts(direction, page, base_id) if objs: if direction == 'prev': objs.reverse() if MYSQL_TO_KVDB_SUPPORT: fromid = objs[0]['id'] endid = objs[-1]['id'] else: fromid = objs[0].id endid = objs[-1].id else: fromid = endid = '' allpost = Article.count_all_post() allpage = allpost / EACH_PAGE_POST_NUM if allpost % EACH_PAGE_POST_NUM: allpage += 1 output = self.render('index.html', { 'title': "%s - %s | Part %s" % (getAttr('SITE_TITLE'), getAttr('SITE_SUB_TITLE'), page), 'keywords': getAttr('KEYWORDS'), 'description': getAttr('SITE_DECR'), 'objs': objs, 'cats': Category.get_all_cat_name(), 'tags': Tag.get_hot_tag_name(), 'archives': Archive.get_all_archive_name(), 'page': int(page), 'allpage': allpage, 'listtype': 'index', 'fromid': fromid, 'endid': endid, 'comments': Comment.get_recent_comments(), 'links': Link.get_all_links(), 'isauthor': self.isAuthor(), 'Totalblog': get_count('Totalblog', NUM_SHARDS, 0), }, layout='_layout.html') self.write(output) return output
def get(self): try: objs = Article.get_post_for_homepage() except: self.redirect('/install') return if objs: if MYSQL_TO_KVDB_SUPPORT: fromid = objs[0]['id'] endid = objs[-1]['id'] #totalblog = Article.get_totalnum_arti() totalblog = get_count('Totalblog',NUM_SHARDS,0) else: fromid = objs[0].id endid = objs[-1].id totalblog = get_count('Totalblog',NUM_SHARDS,0) else: fromid = endid = '' allpost = Article.count_all_post() allpage = allpost/EACH_PAGE_POST_NUM if allpost%EACH_PAGE_POST_NUM: allpage += 1 output = self.render('index.html', { 'title': "%s - %s"%(getAttr('SITE_TITLE'),getAttr('SITE_SUB_TITLE')), 'keywords':getAttr('KEYWORDS'), 'description':getAttr('SITE_DECR'), 'objs': objs, 'cats': Category.get_all_cat_name(), 'tags': Tag.get_hot_tag_name(), 'archives': Archive.get_all_archive_name(), 'page': 1, 'allpage': allpage, 'listtype': 'index', 'fromid': fromid, 'endid': endid, 'comments': Comment.get_recent_comments(), 'links':Link.get_all_links(), 'isauthor':self.isAuthor(), 'Totalblog':totalblog, },layout='_layout.html') self.write(output) return output
def get(self, direction = 'next', page = '2', base_id = '1'): if page == '1': self.redirect(BASE_URL) return objs = Article.get_page_posts(direction, page, base_id) if objs: if direction == 'prev': objs.reverse() if MYSQL_TO_KVDB_SUPPORT: fromid = objs[0]['id'] endid = objs[-1]['id'] else: fromid = objs[0].id endid = objs[-1].id else: fromid = endid = '' allpost = Article.count_all_post() allpage = allpost/EACH_PAGE_POST_NUM if allpost%EACH_PAGE_POST_NUM: allpage += 1 output = self.render('index.html', { 'title': "%s - %s | Part %s"%(getAttr('SITE_TITLE'),getAttr('SITE_SUB_TITLE'), page), 'keywords':getAttr('KEYWORDS'), 'description':getAttr('SITE_DECR'), 'objs': objs, 'cats': Category.get_all_cat_name(), 'tags': Tag.get_hot_tag_name(), 'archives': Archive.get_all_archive_name(), 'page': int(page), 'allpage': allpage, 'listtype': 'index', 'fromid': fromid, 'endid': endid, 'comments': Comment.get_recent_comments(), 'links':Link.get_all_links(), 'isauthor':self.isAuthor(), 'Totalblog':get_count('Totalblog',NUM_SHARDS,0), },layout='_layout.html') self.write(output) return output
def get(self, direction='next', page='2', base_id='1'): if page == '1': self.redirect(BASE_URL) return objs = Article.get_page_posts(direction, page, base_id) if objs: if direction == 'prev': objs.reverse() fromid = objs[0].id endid = objs[-1].id else: fromid = endid = '' allpost = Article.count_all_post() allpage = allpost / EACH_PAGE_POST_NUM if allpost % EACH_PAGE_POST_NUM: allpage += 1 output = self.render( 'index.html', { 'title': "%s - %s | Part %s" % (SITE_TITLE, SITE_SUB_TITLE, page), 'keywords': KEYWORDS, 'description': SITE_DECR, 'objs': objs, 'cats': Category.get_all_cat_name(), 'tags': Tag.get_hot_tag_name(), 'page': int(page), 'allpage': allpage, 'listtype': 'index', 'fromid': fromid, 'endid': endid, 'comments': Comment.get_recent_comments(), 'links': Link.get_all_links(), }, layout='_layout.html') self.write(output) return output
def get(self): try: objs = Article.get_post_for_homepage() except: self.redirect('/install') return if objs: if MYSQL_TO_KVDB_SUPPORT: fromid = objs[0]['id'] endid = objs[-1]['id'] #totalblog = Article.get_totalnum_arti() totalblog = get_count('Totalblog', NUM_SHARDS, 0) else: fromid = objs[0].id endid = objs[-1].id totalblog = get_count('Totalblog', NUM_SHARDS, 0) else: fromid = endid = '' allpost = Article.count_all_post() allpage = allpost / EACH_PAGE_POST_NUM if allpost % EACH_PAGE_POST_NUM: allpage += 1 output = self.render('index.html', { 'title': "%s - %s" % (getAttr('SITE_TITLE'), getAttr('SITE_SUB_TITLE')), 'keywords': getAttr('KEYWORDS'), 'description': getAttr('SITE_DECR'), 'objs': objs, 'cats': Category.get_all_cat_name(), 'tags': Tag.get_hot_tag_name(), 'archives': Archive.get_all_archive_name(), 'page': 1, 'allpage': allpage, 'listtype': 'index', 'fromid': fromid, 'endid': endid, 'comments': Comment.get_recent_comments(), 'links': Link.get_all_links(), 'isauthor': self.isAuthor(), 'Totalblog': totalblog, }, layout='_layout.html') self.write(output) return output