From 06b784da5705b0bf7a471da6d73c46ef27ac1f46 Mon Sep 17 00:00:00 2001 From: Dimitri Huisman Date: Sat, 29 Oct 2022 08:57:48 +0000 Subject: [PATCH] Shorten default function by using lambda --- core/admin/mailu/models.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/core/admin/mailu/models.py b/core/admin/mailu/models.py index 1e703e1a..2d276a8a 100644 --- a/core/admin/mailu/models.py +++ b/core/admin/mailu/models.py @@ -509,12 +509,7 @@ class User(Base, Email): displayed_name = db.Column(db.String(160), nullable=False, default='') spam_enabled = db.Column(db.Boolean, nullable=False, default=True) spam_mark_as_read = db.Column(db.Boolean, nullable=False, default=True) - def default_spam_threshold(cls): - if app: - return app.config['DEFAULT_SPAM_THRESHOLD'] - else: - return 80 - spam_threshold = db.Column(db.Integer, nullable=False, default=default_spam_threshold) + spam_threshold = db.Column(db.Integer, nullable=False, default=lambda:int(app.config.get("DEFAULT_SPAM_THRESHOLD", 80))) # Flask-login attributes is_authenticated = True