def get(self, page): # 校验身份 if self.check_login() == False: self.redirect("/login") return # 处理请求页面 if 1 == 1: if page == "index": self.MyRender(admin_dir("%s.html" % page), classify=db.get_classify()) # 文章管理 elif page == "articles": self.MyRender(admin_dir("%s.html" % page), articles=db.get_article()) # 更新文章 elif page == "update": id = self.get_argument("id") self.MyRender( admin_dir("%s.html" % page), classify=db.get_classify(), article=db.get_atcbyid(id, True), id=id ) # 评论管理 elif page == "comments": self.MyRender(admin_dir("%s.html" % page), comments=db.get_comments()) # 留言管理 elif page == "guests": self.MyRender(admin_dir("%s.html" % page), guests=db.get_guest()) # 留言管理 elif page == "links": self.MyRender(admin_dir("%s.html" % page), links=db.get_links()) # 分类管理 elif page == "classify": self.MyRender(admin_dir("%s.html" % page), classify=db.get_classify()) # 分类管理 elif page == "upload": self.MyRender(admin_dir("%s.html" % page)) # 博客配置 elif page == "options": self.MyRender(admin_dir("%s.html" % page), templates=os.listdir(cur_dir() + "templates")) # 返回自定义页面 else: # self.MyRender(admin_dir("%s.html" % page)) self.redirect("/login") else: self.redirect("/login")
def render(self): list = db.get_classify() return self.MyRender(tmp_dir("sidebar.html"))