Exemplo n.º 1
0
    def get(self, page_title, revision=None):
        page_title = page_title.strip('/')
        user = self.authenticate_session_id()

        if not user:
            self.redirect("/login")
        elif revision is None:
            p = Page.get_newest(page_title)
            if p:
                self.render("edit.html", user=user.username, title=p.title, content=p.content)
        elif revision == "/new" or revision == "new":
            self.render("edit.html", user=user.username, title=page_title)
        else:
            revision = int(revision.strip('/'))
            p = Page.get(page_title, revision)
            self.render("edit.html", user=user.username, title=page_title, content=p.content)
Exemplo n.º 2
0
    def get(self, page_title, revision=None):
        user = self.authenticate_session_id()

        #remove slash at beginning
        page_title = page_title.strip('/')

        if revision is None:
            p = Page.get_newest(page_title)
        else:
            #change to int
            revision = int(revision.strip('/'))
            p = Page.get(page_title, revision)

        if p:
            md = markdown.Markdown(safe_mode='escape', output_format='html5', extensions=['attr_list', 'fenced_code', 'codehilite'])
            content = md.convert(p.content)
            if user:
                self.render("wikipage.html", user=user.username, content=content, title=p.title, creator=p.created_by, last_editor=p.edited_by, version=p.revision)
            else:
                self.render("wikipage.html", content=content, title=p.title, creator=p.created_by, last_editor=p.edited_by, version=p.revision)
        else:
            self.redirect("/_edit/" + page_title + "/new")

        """