def post(self): title = self.get_argument('title') author = get_global_config('admin_name', 'admin') content = self.get_argument('content') brief = self.get_argument('brief', '') is_public = True if self.get_argument('public') == '1' else False tags = self.get_argument('tags', '').split(',') ret = posts.new_post(author, title, tags, content, brief, is_public) return self.finish(ret)
def get(self): pid = int(self.get_argument('pid')) p = posts.get_posts(query={'pid':int(pid)}) if len(p) > 0: blog = p[0] self.render('content.html', blog = blog, title = get_global_config('site_name')) else: self.finish('no such post')
def get(self): blogs = posts.get_posts(fields=['title', 'create_ts', 'pid', 'public']) self.render('admin.html', blogs=blogs, title=get_global_config('site_name'))
def get(self): pid = self.get_argument('pid') p = posts.get_posts(query={'pid':int(pid)}) if len(p) > 0: post = p[0] self.render('editpost.html',pid=post['pid'] ,post=post, is_new = False, title=get_global_config('site_name'))
def get(self): self.render('editpost.html', post=posts.empty_post(), is_new=True, title=get_global_config('site_name'))
def post(self): u = self.get_argument('username') pwd = self.get_argument('password') if u == get_global_config('admin_name') and pwd == get_global_config('admin_pwd'): self.set_secure_cookie("is_admin", "1") self.redirect('/admin')
def get(self): self.render('auth.html', title= get_global_config('site_name'))
def get(self): #p = 0 if not self.get_argument('p', None) else int(self.get_argument('p')) blogs = posts.get_posts(query={'public':True}) self.render('posts.html', blogs = blogs, title = get_global_config('site_name'))