def post(self, title): content = self.get_argument('content', None) parent_id = self.get_argument('parent_id', None) root_item = WikiItem.get_by_keyword(title) if root_item and content: if root_item.current: parent = WikiArticle.get_by_pk(parent_id) if root_item.id == parent.root: article = WikiArticle.new(self.current_user(), root_item, parent, content) return else: article = WikiArticle.new(self.current_user(), root_item, None, content) return # 非标准提交直接转向 self.redirect(url_for('index'))
def get(self, title): item = WikiItem.get_by_keyword(title) if item: self.render('wiki/wiki_new.html', nav='wiki', item=item) else: self.write_error(404)
def get(self, title): item = WikiItem.get_by_keyword(title) self.render('wiki/item_page.html', nav='wiki', item=item)