示例#1
0
文件: views.py 项目: tekd/noi2
def my_profile_upload_picture():
    form = PictureForm()
    # TODO: Is it possible for 'X-Upload-Too-Big' to be in request.headers,
    # and if so, should we deal with it?
    if form.validate():
        if form.picture.has_file():
            set_user_picture(current_user, form.picture)
            db.session.add(current_user)
            db.session.commit()
            return ('', 204)
    abort(400)
示例#2
0
def my_profile_upload_picture():
    form = PictureForm()
    # TODO: Is it possible for 'X-Upload-Too-Big' to be in request.headers,
    # and if so, should we deal with it?
    if form.validate():
        if form.picture.has_file():
            set_user_picture(current_user, form.picture)
            db.session.add(current_user)
            db.session.commit()
            return ('', 204)
    abort(400)
示例#3
0
文件: views.py 项目: GovLab/noi2
def my_profile_upload_picture():
    form = PictureForm()
    # TODO: Is it possible for 'X-Upload-Too-Big' to be in request.headers,
    # and if so, should we deal with it?
    if form.validate():
        if form.picture.has_file():
            set_user_picture(current_user, form.picture)
            db.session.add(current_user)
            db.session.commit()
            signals.user_changed_profile.send(
                current_app._get_current_object(),
                user=current_user._get_current_object(),
                avatar_changed=True
            )
            return ('', 204)
    abort(400)