Exemplo n.º 1
0
 def get(self, path):
     pages = Page.by_path(path)
     
     if pages:
         self.render("history-page.html", pages = pages, path = path)
     else:
         self.redirect("/wiki/_edit" + path)
Exemplo n.º 2
0
    def get(self, path):
        q = Page.by_path(path)
        q.fetch(100)

        posts = list(q)
        if posts:
            self.render('history.html', path=path, posts=posts)
        else:
            self.redirect('/_edit' + path)
Exemplo n.º 3
0
 def get(self, path):
     v = self.request.get('v')
     p = None
     if v:
         if v.isdigit():
             p = Page.by_id(int(v), path)
         if not p:
             return self.not_found()
     else:
         p = Page.by_path(path).get()
     if p:
         self.render('page.html', path=path, page=p)
     else:
         self.redirect('/_edit' + path)
Exemplo n.º 4
0
    def post(self, path):
        if not self.user:
            self.error(400)
            return

        content = self.request.get('content')
        old_page = Page.by_path(path).get()
        if not (old_page or content):
            return
        elif not old_page or old_page.content != content:
            p = Page(parent=Page.parent_key(path), content=content)
            p.put()

        self.redirect(path)
Exemplo n.º 5
0
    def get(self, path):
        if not self.user:
            self.redirect('/login')

        v = self.request.get('v')
        p = None
        if v:
            if v.isdigit():
                p = Page.by_id(int(v), path)
            if not p:
                return self.not_found()
        else:
            p = Page.by_path(path).get()
        self.render('edit.html', path=path, page=p)
Exemplo n.º 6
0
 def get(self, path):
     v = self.request.get('v')
     page = None
     if v:
         if v.isdigit():
             page = Page.by_id(int(v), path)
         if not page:
             self.error(404)
             return
     else:
         page = Page.by_path(path).get()
     
     if page:
         self.render("wiki-page.html", page = page, path = path)
     else:
         self.redirect("/wiki/_edit" + path)
Exemplo n.º 7
0
    def get(self, path):
        if not self.user:
            self.redirect("/wiki/login")

        v = self.request.get('v')
        page = None
        if v:
            if v.isdigit():
                page = Page.by_id(int(v), path)
            if not page:
                self.error(404)
                return
        else:
            page = Page.by_path(path).get()

        self.render("edit-page.html", page = page, path = path)