blog/app/routes.py
def edit_post(post_oid):
    """ Pulls a post for editing in the webapp. """

    # first, make sure we can even get a post to edit
    post_object = posts.Post(_id=ObjectId(post_oid))

    # the GET is for editing in the webapp; the POST 
    # is for updating MDB
    if flask.request.method == 'GET':
        if not flask_login.current_user.is_authenticated:
            return flask.redirect(flask.url_for('admin'))
        return flask.render_template(
            'admin_edit.html',
            post=post_object.serialize(),
            **app.config
            )
    else:   # if flesk.request.method == 'POST'
        post_object.update()
        return flask.Response(
            response=json.dumps(
                post_object.serialize(),
                default=json_util.default
            ),
            status=200,
            mimetype='application/json',
        )
 Pulls a post for editing in the webapp. 
Pulls a post for editing in the webapp.
Pulls a post for editing in the webapp .
def edit_post(post_oid):
    post_object = posts.Post(_id=ObjectId(post_oid))
    if flask.request.method == 'GET':
        if not flask_login.current_user.is_authenticated:
            return flask.redirect(flask.url_for('admin'))
        return flask.render_template(
            'admin_edit.html',
            post=post_object.serialize(),
            **app.config
            )
    else:   
        post_object.update()
        return flask.Response(
            response=json.dumps(
                post_object.serialize(),
                default=json_util.default
            ),
            status=200,
            mimetype='application/json',
        )
def edit_post ( post_oid ) : post_object = posts . Post ( _id = ObjectId ( post_oid ) ) if flask . request . method == 'GET' : if not flask_login . current_user . is_authenticated : return flask . redirect ( flask . url_for ( 'admin' ) ) return flask . render_template ( 'admin_edit.html' , post = post_object . serialize ( ) , ** app . config ) else : post_object . update ( ) return flask . Response ( response = json . dumps ( post_object . serialize ( ) , default = json_util . default ) , status = 200 , mimetype = 'application/json' , )
Pulls a post for editing in the webapp.
Pulls a post for editing in the webapp .
""" Pulls a post for editing in the webapp. """ # first, make sure we can even get a post to edit # the GET is for editing in the webapp; the POST  # is for updating MDB # if flesk.request.method == 'POST'
post_oid