Exemplo n.º 1
0
    def post(self):
        article = Article()
        # get post values
        post_values = ['title', 'brief', 'content']
        args = {}
        for v in post_values:
            # Get nessary argument
            # Use None as default if argument is not supplied
            args[v] = self.get_argument(v, None)
  
        article.set_sn()
        article.set_title(args['title'])
        article.set_sub_title(args['brief'])
        article.set_markdown(args['content'])
        article.set_html(markdown(args['content'], 
                        ['fenced_code', 'codehilite'], 
                        safe_mode= "escape"))

        current_user = self.get_current_user()
        article.set_author(current_user['uid'])
        article.put()
        self.redirect('/')
Exemplo n.º 2
0
    def post(self):
        article = Article()
        # get post values
        post_values = ['title', 'brief', 'content']
        args = {}
        for v in post_values:
            # Get nessary argument
            # Use None as default if argument is not supplied
            args[v] = self.get_argument(v, None)
  
        article.set_sn()
        article.set_title(args['title'])
        article.set_sub_title(args['brief'])
        article.set_markdown(args['content'])
        article.set_html(markdown(args['content'], 
                        ['fenced_code', 'codehilite'], 
                        safe_mode= "escape"))

        current_user = self.get_current_user()
        article.set_author(current_user['uid'])
        article.put()
        self.redirect('/')
Exemplo n.º 3
0
    def post(self, sn):
        # get post values
        post_values = ['title', 'brief', 'content']
        args = {}
        for v in post_values:
            # Get nessary argument
            # Use None as default if argument is not supplied
            args[v] = self.get_argument(v, None)

        current_user = self.get_current_user() # wrapped

        article = Article(da.get_article_by_sn(int(sn)))
        
        article.set_title(args['title'])
        article.set_sub_title(args['brief'])
        article.set_markdown(args['content'])
        article.set_html(markdown(args['content'], 
                        ['fenced_code', 'codehilite'], 
                        safe_mode= "escape"))
        article.set_review()
        article.put()
        self.redirect("/article/%s" % sn)
Exemplo n.º 4
0
    def post(self, sn):
        # get post values
        post_values = ['title', 'brief', 'content']
        args = {}
        for v in post_values:
            # Get nessary argument
            # Use None as default if argument is not supplied
            args[v] = self.get_argument(v, None)

        current_user = self.get_current_user() # wrapped

        article = Article(da.get_article_by_sn(int(sn)))
        
        article.set_title(args['title'])
        article.set_sub_title(args['brief'])
        article.set_markdown(args['content'])
        article.set_html(markdown(args['content'], 
                        ['fenced_code', 'codehilite'], 
                        safe_mode= "escape"))
        article.set_review()
        article.put()
        self.redirect("/article/%s" % sn)