def get(self): count, data = Post.get_post(page=1, pagesize=15) self.datamap['rss'] = data self.set_header('Content-Type', 'application/xml;charset=utf-8') import common rtn = render.rss(self.datamap) self.write(rtn) return rtn
def get(self, category, page=1): page = int(page) category = category[:-1] count, data = Post.get_post(page=page, pagesize=blogconfig['pagesize'], category=category) self.datamap['recent'] = Post.get_recent_post() self.datamap['count'] = count self.datamap['data'] = data self.datamap['pageurl'] = 'category' self.datamap['page'] = page self.datamap['pagecount'] = int(math.ceil(float(count) / blogconfig['pagesize'])) rtn = render.blog_index(self.datamap) self.write(rtn) return rtn
def get(self): page = int(self.get_argument('page', '1')) key = self.get_argument('key', '') act = self.get_argument('act', '') if act == 'delete': Post.delete_post_by_id(int(self.get_argument('id', 0))) pagesize = 20 count, blogs = Post.get_post(page=page, pagesize=pagesize, showall=True, keyword=key, onlypost=False) for x in blogs: x.length = len(x.content) self.datamap['count'] = count self.datamap['posts'] = blogs self.datamap['page'] = int(page) self.datamap['pagecount'] = int(math.ceil(float(count) / pagesize)) self.write(render_admin.post(self.datamap))
def get(self, page=1): page = int(page) count, data = 0, None key = self.get_argument('s', '') if key: key = key.replace("'", "\'") self.datamap['key'] = key count, data = Post.search_post_by_title(key) else: count, data = Post.get_post(page=page, pagesize=blogconfig['pagesize']) self.datamap['recent'] = Post.get_recent_post() self.datamap['count'] = count self.datamap['data'] = data self.datamap['page'] = int(page) self.datamap['pageurl'] = 'page' self.datamap['pagecount'] = int(math.ceil(float(count) / blogconfig['pagesize'])) rtn = render.blog_index(self.datamap) self.write(rtn) return rtn