def get(self, page_name): user = self.check_login_status() view = self.request.get('v') if not page_name: if not view: page = Page.get_by_key_name('/') else: if view.isdigit(): view = int(view) pages = HistoryItem.get_by_page_name('/') if view <= len(pages): page = pages[int(view) - 1] else: self.abort(404) else: self.abort(404) else: if not view: page = Page.get_by_key_name(page_name) else: if view.isdigit(): view = int(view) pages = HistoryItem.get_by_page_name(page_name) if view <= len(pages): page = pages[int(view) - 1] else: self.abort(404) else: self.abort(404) self.render('wiki_edit.html', page=page, user=user)
def get(self, page_name): user = self.check_login_status() view = self.request.get('v') if not page_name: if not view: page = Page.get_by_key_name('/') else: if view.isdigit(): view = int(view) pages = HistoryItem.get_by_page_name('/') if view <= len(pages): page = pages[view - 1] else: self.abort(404) else: self.abort(404) else: if not view: page = Page.get_by_key_name(page_name) else: if view.isdigit(): view = int(view) pages = HistoryItem.get_by_page_name(page_name) if view <= len(pages): page = pages[view - 1] else: self.abort(404) else: self.abort(404) if not page and page_name: self.redirect('/wiki/_edit/%s' % page_name) elif not page: self.redirect('/wiki/_edit') else: if view: self.render('wiki.html', user=user, page=page, view=view) else: self.render('wiki.html', user=user, page=page)