Apply suggestions from code review

Co-authored-by: link2xt <link2xt@testrun.org>
This commit is contained in:
holger krekel
2024-07-09 18:34:40 +02:00
parent 9b15d8de24
commit a1f0a3e23b
3 changed files with 4 additions and 4 deletions

View File

@@ -13,7 +13,7 @@ def read_config(inipath, mail_basedir=None):
class Config:
def __init__(self, inipath, params, mail_basedir):
def __init__(self, inipath, params, mail_basedir: Path):
self._inipath = inipath
self.mail_domain = params["mail_domain"]
self.max_user_send_per_minute = int(params["max_user_send_per_minute"])

View File

@@ -124,7 +124,7 @@ def lookup_passdb(db, config: Config, user, cleartext_password, last_login=None)
q = """INSERT INTO users (addr, password, last_login)
VALUES (?, ?, ?)"""
conn.execute(q, (user, encrypted_password, last_login))
print(f"Created e-mail address: {user}", file=sys.stderr)
print(f"Created address: {user}", file=sys.stderr)
return dict(
home=f"/home/vmail/mail/{config.mail_domain}/{user}",
uid="vmail",
@@ -146,7 +146,7 @@ def iter_userdb_lastlogin_before(db, cutoff_date):
"""Get a list of users where last login was before cutoff_date."""
with db.read_connection() as conn:
rows = conn.execute(
"SELECT addr FROM users WHERE last_login <?", (cutoff_date,)
"SELECT addr FROM users WHERE last_login < ?", (cutoff_date,)
).fetchall()
return [x[0] for x in rows]

View File

@@ -9,4 +9,4 @@
2 0 * * * vmail find /home/vmail/mail/{{ config.mail_domain }} -path '*/tmp/*' -mtime +{{ config.delete_mails_after }} -type f -delete
2 0 * * * vmail find /home/vmail/mail/{{ config.mail_domain }} -path '*/.*/tmp/*' -mtime +{{ config.delete_mails_after }} -type f -delete
3 0 * * * vmail find /home/vmail/mail/{{ config.mail_domain }} -name 'maildirsize' -type f -delete
4 0 * * * vmail /usr/local/lib/chatmaild/venv/bin/delete_inactive_users /home/vmail/passdb.lite /usr/local/lib/chatmaild/chatmail.ini
4 0 * * * vmail /usr/local/lib/chatmaild/venv/bin/delete_inactive_users /home/vmail/passdb.sqlite /usr/local/lib/chatmaild/chatmail.ini