当前位置: 首页>>代码示例>>Python>>正文


Python Post.update方法代码示例

本文整理汇总了Python中post.Post.update方法的典型用法代码示例。如果您正苦于以下问题:Python Post.update方法的具体用法?Python Post.update怎么用?Python Post.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在post.Post的用法示例。


在下文中一共展示了Post.update方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: post

# 需要导入模块: from post import Post [as 别名]
# 或者: from post.Post import update [as 别名]
    def post(self,post_id):

        if not self.user:
            self.redirect('/blog/%s' % post_id)

        subject = self.request.get('subject')
        content = self.request.get('content')
        user_id = self.user.key().id()
        last_modified = datetime.datetime.now()
        post = Post.by_id(post_id)
        if post and post.created_by == user_id:
           Post.update(post_id,subject,content,last_modified)
        self.redirect('/blog/%s' % post_id)
开发者ID:YouYue123,项目名称:Fullstack-Udacity,代码行数:15,代码来源:main.py

示例2: post

# 需要导入模块: from post import Post [as 别名]
# 或者: from post.Post import update [as 别名]
def post(id=None):
    if request.method == 'POST':
        setting = request.form.get('setting')
        post_id = request.form.get('value_0')
        value = request.form.get('value_1')

        if not setting or not post_id:
            abort(400)
        try:
            post_id = int(post_id)
        except:
            abort(400)

        post = Post(post_id=post_id)

        if not post.id:
            abort(400)

        if setting == 'delete':
            post.delete()
            flash(messages.post_deleted)

            if request.form.get('next'):
                return redirect(request.form['next'])
            return redirect(url_for('admin_post'))

        elif setting == 'public':
            if not value:
                abort(400)

            if value == 'True':
                post.set_public()
                flash(messages.post_marked_public)
            else:
                post.update('is_public', False)
                flash(messages.post_marked_private)

        return redirect(url_for('admin_post_id', id=post_id))

    else:
        if id:
            post = Post(post_id=id)
            post = post.get_post()

            if not post:
                flash(messages.post_not_found)
        else:
            post = None

        return render_template('admin/post.html', post=post)
开发者ID:davidnieder,项目名称:blackboard,代码行数:52,代码来源:admin.py

示例3: update

# 需要导入模块: from post import Post [as 别名]
# 或者: from post.Post import update [as 别名]
def update():
    request_data = get_json(request)

    code, response = Post.update(request_data['post'], request_data['message'])
    return json.dumps(
        {'code': code,
         'response': response}
    )
开发者ID:dm-tyurin,项目名称:tp-subd,代码行数:10,代码来源:post_view.py

示例4: expand

# 需要导入模块: from post import Post [as 别名]
# 或者: from post.Post import update [as 别名]
    def expand(self,board,post_id, message=None):
        if not self.in_course_list(board):
            return "whatever."
#            pass
        post = Post(board, post_id=post_id)
        if cherrypy.request.method == 'POST':
            if not message:
                print('Message was empty')
                pass #Add to errors or something...
            else:
                post.add_reply(message)
        post.update()
        #display the post and responses for post_id
        post = Post(board, post_id=post_id)
        #Render the page
           
        name_space = {'post':post,'course':board}
        return str(Template(self.expand_template, name_space))
开发者ID:a-hitti,项目名称:Courseboards,代码行数:20,代码来源:board.py


注:本文中的post.Post.update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。