Beispiel #1
0
 def post(self, id):
     markdown = self.get_argument("markdown", None)
     if not markdown:
         self.redirect("/post/update/%s" % str(id))
     p = render_post(markdown)
     post = {"title": p["meta"]["title"], "slug": p["meta"]["slug"],
             "tags": p["meta"]["tags"], "category": p["meta"]["category"],
             "published": p["meta"]["published"], "content": p["content"]}
     result = self.update_post_by_id(int(id), **post)
     self.redirect("/%s" % p["meta"]["slug"])
     return
Beispiel #2
0
    def post(self):
        markdown = self.get_argument("markdown", None)
        if not markdown:
            self.redirect("/post/new")
        p = render_post(markdown)
        post = {"title": p["meta"]["title"], "slug": p["meta"]["slug"],
                "tags": p["meta"]["tags"], "category": p["meta"]["category"],
                "published": p["meta"]["published"], "content": p["content"]}

        post_id = self.create_new_post(**post)
        self.redirect("/%s" % p["meta"]["slug"])
        return
Beispiel #3
0
 def post(self):
     markdown = self.get_argument("markdown", None)
     if not markdown:
         self.redirect("/picky/new")
     p = render_post(markdown)
     title = p["meta"]["title"]
     slug = p["meta"]["slug"]
     published = p["meta"]["published"]
     content = p["content"]
     html = self.render_string("picky.html", title=title, slug=slug,
                            published=published, content=content)
     self._create_html(html, slug)
     self.redirect("/picky/%s" % slug)
     return
Beispiel #4
0
 def get(self, slug):
     mdfile = PICKY_DIR + "/" + str(slug) + ".md"
     try:
         md = open(mdfile)
     except IOError:
         print "Not"
         self.abort(404)
     markdown = md.read()
     md.close()
     p = render_post(markdown)
     title = p["meta"]["title"]
     published = p["meta"]["published"]
     content = p["content"]
     self.render("picky.html", title=title, slug=slug,
         published=published, content=content)
Beispiel #5
0
 def post(self, id):
     markdown = self.get_argument("markdown", None)
     comment = self.get_argument("comment", 1)
     print comment
     if not markdown:
         self.redirect("/post/update/%s" % str(id))
     if comment == '0':
         comment = 0
     p = render_post(markdown)
     post = {"title": p["meta"]["title"], "slug": p["meta"]["slug"],
             "tags": p["meta"]["tags"], "category": p["meta"]["category"],
             "published": p["meta"]["published"],
             "content": p["content"], "comment": comment}
     self.update_post_by_id(int(id), **post)
     self.redirect("/%s" % p["meta"]["slug"])
     return
Beispiel #6
0
    def post(self):
        markdown = self.get_argument("markdown", None)
        comment = self.get_argument("comment", 1)
        if not markdown:
            self.redirect("/post/new")
        p = render_post(markdown)
        if comment == '0':
            comment = 0
        post = {"title": p["meta"]["title"], "slug": p["meta"]["slug"],
                "tags": p["meta"]["tags"], "category": p["meta"]["category"],
                "published": p["meta"]["published"],
                "content": p["content"], "comment": comment}

        self.create_new_post(**post)
        self.redirect("/%s" % p["meta"]["slug"])
        return