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, name=''): objs = Tag.get_tag_page_posts(name, 1) catobj = Tag.get_tag_by_name(name) if catobj: pass else: self.redirect(BASE_URL) return allpost = catobj.id_num allpage = allpost / EACH_PAGE_POST_NUM if allpost % EACH_PAGE_POST_NUM: allpage += 1 output = self.render('index.html', { 'title': "%s - %s" % (catobj.name, SITE_TITLE), 'keywords': catobj.name, 'description': SITE_DECR, 'objs': objs, 'cats': Category.get_all_cat_name(), 'tags': Tag.get_hot_tag_name(), 'page': 1, 'allpage': allpage, 'listtype': 'tag', 'name': name, 'namemd5': md5(name.encode('utf-8')).hexdigest(), 'comments': Comment.get_recent_comments(), 'links': Link.get_all_links(), }, layout='_layout.html') self.write(output) return output
def get(self, name = ''): objs = Tag.get_tag_page_posts(name, 1) catobj = Tag.get_tag_by_name(name) if catobj: pass else: self.redirect(BASE_URL) return allpost = catobj.id_num allpage = allpost/EACH_PAGE_POST_NUM if allpost%EACH_PAGE_POST_NUM: allpage += 1 output = self.render('index.html', { 'title': "%s - %s"%( catobj.name, SITE_TITLE), 'keywords':catobj.name, 'description':SITE_DECR, 'objs': objs, 'cats': Category.get_all_cat_name(), 'tags': Tag.get_hot_tag_name(), 'page': 1, 'allpage': allpage, 'listtype': 'tag', 'name': name, 'namemd5': md5(name.encode('utf-8')).hexdigest(), 'comments': Comment.get_recent_comments(), 'links':Link.get_all_links(), },layout='_layout.html') self.write(output) return output
def get(self, id = '', title = ''): tmpl = '' obj = Article.get_article_by_id_detail(id) if not obj: self.redirect(BASE_URL) return #redirect to right title try: title = unquote(title).decode('utf-8') except: pass if title != obj.slug: self.redirect(obj.absolute_url, 301) return # if obj.password and THEME == 'default': rp = self.get_cookie("rp%s" % id, '') if rp != obj.password: tmpl = '_pw' self.set_header("Last-Modified", obj.last_modified) output = self.render('page%s.html'%tmpl, { 'title': "%s - %s"%(obj.title, SITE_TITLE), 'keywords':obj.keywords, 'description':obj.description, 'obj': obj, 'cobjs': obj.coms, 'postdetail': 'postdetail', 'cats': Category.get_all_cat_name(), 'tags': Tag.get_hot_tag_name(), 'page': 1, 'allpage': 10, 'comments': Comment.get_recent_comments(), 'links':Link.get_all_links(), },layout='_layout.html') self.write(output) if obj.password and THEME == 'default': return else: return output
def get(self, id='', title=''): tmpl = '' obj = Article.get_article_by_id_detail(id) if not obj: self.redirect(BASE_URL) return #redirect to right title try: title = unquote(title).decode('utf-8') except: pass if title != obj.slug: self.redirect(obj.absolute_url, 301) return # if obj.password and THEME == 'default': rp = self.get_cookie("rp%s" % id, '') if rp != obj.password: tmpl = '_pw' self.set_header("Last-Modified", obj.last_modified) output = self.render('page%s.html' % tmpl, { 'title': "%s - %s" % (obj.title, SITE_TITLE), 'keywords': obj.keywords, 'description': obj.description, 'obj': obj, 'cobjs': obj.coms, 'postdetail': 'postdetail', 'cats': Category.get_all_cat_name(), 'tags': Tag.get_hot_tag_name(), 'page': 1, 'allpage': 10, 'comments': Comment.get_recent_comments(), 'links': Link.get_all_links(), }, layout='_layout.html') self.write(output) if obj.password and THEME == 'default': return else: 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: 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') print '---------------------------------------' self.write(output) print '---------------------------------------'
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') print '---------------------------------------' self.write(output) print '---------------------------------------'