From 11104fe96b1aaf3b0b880f9d05c9e1ad183bfd1a Mon Sep 17 00:00:00 2001 From: Yapollon Date: Thu, 7 Mar 2024 15:56:06 +0100 Subject: [PATCH] cleaned code yippie --- app.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/app.py b/app.py index 1a1479d..ab85908 100644 --- a/app.py +++ b/app.py @@ -1,7 +1,6 @@ import datetime import hashlib import os -# import imageio from PIL import Image from flask import Flask, render_template, redirect, url_for, request, jsonify @@ -16,6 +15,8 @@ from utils import anonymous_required # Create a new Flask instance app = Flask(__name__) app.secret_key = 'PSSSSSHHHT!' +UPLOAD_FOLDER = 'static/profile_images/' # Folder to store profile images +app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER # Initialize the Flask-Login extension login_manager = LoginManager() @@ -243,7 +244,7 @@ def habit_create(): unit = 1 # Save habit to database - habit = Habit.create(list_id, name, times, note, unit) + Habit.create(list_id, name, times, note, unit) # Back to index return redirect(url_for('index')) @@ -270,7 +271,7 @@ def habit_list_create(): if not name: errors['name'] = 'Der Name ist erforderlich.' if not description: - note = '' + description = '' if errors: return render_template( @@ -282,7 +283,7 @@ def habit_list_create(): ) # Save habit to database - habit = HabitList.create(current_user.id, name, description) + HabitList.create(current_user.id, name, description) # Back to index return redirect(url_for('index')) @@ -386,7 +387,7 @@ def edit_habit_change(): # check if list_id is an int try: - list_id = int(list_id) + int(list_id) except ValueError: errors['list_query'] = 'Die Anzahl muss eine Zahl sein.' @@ -465,9 +466,6 @@ def password_change(): def save_profile_image(image_file): - UPLOAD_FOLDER = 'static/profile_images/' # Folder to store profile images - app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER - filename = image_file.filename if '.' not in filename: # Ensure the filename has an extension