def set_name(): try: new_name = request.form['name'] except KeyError: return abort(400) return user_settings.set_name(new_name) or do_redirect()
def set_profile_preferences(): if g.user is None: return abort(401) data = request.get_json() try: new_email = data.get('settings-profile-email', g.user.email) new_name = data.get('settings-profile-displayname', g.user.name) avatar_url = data.get('avatar-url', g.user.avatar) following_is_public = data.get('settings-privacy-public-following', g.user.following_public) linked_stackexchange_is_public = data.get( 'settings-privacy-public-linked-stackexchange', g.user.linked_stackexchange_public) receive_notifications = data.get( 'settings-profile-receivenotifications', g.user.receive_notifications) except KeyError: return abort(400) return \ user_settings.set_email(new_email) or \ user_settings.set_name(new_name) or \ user_settings.set_avatar(avatar_url) or \ user_settings.set_following_is_public(following_is_public) or \ user_settings.set_linked_stackexchange_is_public(linked_stackexchange_is_public) or \ user_settings.set_receive_notifications(receive_notifications) or \ do_redirect()
def set_profile_preferences(): try: new_email = request.form['email'] new_name = request.form['name'] avatar_url = request.form['avatar-url'] except KeyError: return abort(400) return \ user_settings.set_email(new_email) or \ user_settings.set_name(new_name) or \ user_settings.set_avatar(avatar_url) or \ do_redirect()
def set_profile_preferences(): if g.user is None: return abort(401) try: new_email = request.form.get('settings-profile-email', g.user.email) new_name = request.form.get('settings-profile-displayname', g.user.name) avatar_url = request.form.get('avatar-url', g.user.avatar) except KeyError: return abort(400) return \ user_settings.set_email(new_email) or \ user_settings.set_name(new_name) or \ user_settings.set_avatar(avatar_url) or \ do_redirect()