diff --git a/Website/__init__.py b/Website/__init__.py index bba03dc..307dace 100644 --- a/Website/__init__.py +++ b/Website/__init__.py @@ -10,6 +10,13 @@ preis = -150 #Ein Getraenk #flask_config DATABASE = './Website/mate.db' +def limit_length(text, length=50): + if type(text) != str: + text = str(text) + if len(text) > length: + return f"{text[:(length -3)]}..." + return text + def create_app(test_config=None): app = Flask(__name__) key = str(uuid.uuid4().hex) @@ -17,6 +24,7 @@ def create_app(test_config=None): app.config['SESSION_TYPE'] = 'filesystem' app.config['SECRET_KEY'] = key app.config['DATABASE'] = DATABASE + app.jinja_env.filters['limit_length'] = limit_length else: app.config.from_mapping(test_config) @@ -34,7 +42,7 @@ def create_app(test_config=None): # db = getattr(g, '_database', None) # if db is not None: # db.close() - # app.logger.info("Website exited") + # appt.logger.info("Website exited") #var user_queue = queue.Queue() diff --git a/Website/templates/list.html b/Website/templates/list.html index 07bfad3..1769c42 100644 --- a/Website/templates/list.html +++ b/Website/templates/list.html @@ -21,7 +21,7 @@ Strichliste {% for user in users %}