()
| 12099 | return redirect(url_for("profile")) |
| 12100 | try: |
| 12101 | set_profile_pic(current_user(), f.stream, mime) |
| 12102 | flash("Profile picture updated.") |
| 12103 | except ValueError as ve: |
| 12104 | if str(ve) == "pfp_too_large": |
| 12105 | flash("Picture too large (max 10MB).") |
| 12106 | else: |
| 12107 | flash("Upload failed.") |
| 12108 | except Exception as e: |
| 12109 | log.exception("PFP upload failed: %s", e) |
| 12110 | flash("Upload failed.") |
| 12111 | return redirect(url_for("profile")) |
| 12112 | |
| 12113 | @app.route("/profile/pic/remove", methods=["POST"]) |
| 12114 | @login_required |
| 12115 | def profile_pic_remove(): |
| 12116 | """profile_pic_remove. |
| 12117 | |
| 12118 | Route handler or application helper. |
| 12119 | |
| 12120 | This docstring was expanded to make future maintenance easier. |
| 12121 | |
| 12122 | Returns: |
| 12123 | Varies. |
| 12124 | """ |
| 12125 | try: |
| 12126 | remove_profile_pic(current_user()) |
| 12127 | flash("Profile picture removed.") |
| 12128 | except Exception: |
| 12129 | flash("Remove failed.") |
| 12130 | return redirect(url_for("profile")) |
nothing calls this directly
no test coverage detected