From 694dbb4c942ae16f688ef4d134f35f3b2d09f609 Mon Sep 17 00:00:00 2001 From: Matthieu Dietrich Date: Wed, 29 Jul 2015 16:50:14 +0200 Subject: [PATCH] Correct type for purge_days + better checks --- mail_cleanup/mail_cleanup.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mail_cleanup/mail_cleanup.py b/mail_cleanup/mail_cleanup.py index 002a05018..6f4de5452 100644 --- a/mail_cleanup/mail_cleanup.py +++ b/mail_cleanup/mail_cleanup.py @@ -80,7 +80,7 @@ class FetchmailServer(orm.Model): _get_cleanup_conf, method=True, string='Deletion days', - type="char", + type="integer", multi='outgoing_mail_config', help="Number of days before removing an e-mail"), } @@ -146,12 +146,12 @@ class FetchmailServer(orm.Model): context.update({'fetchmail_server_id': server.id, 'server_type': server.type}) imap_server = False - if server.type == 'imap' and server.cleanup_days > 0: + if server.type == 'imap': try: imap_server = server.connect() - if server.cleanup_days: + if server.cleanup_days > 0: self._cleanup_fetchmail_server(server, imap_server) - if server.purge_days: + if server.purge_days > 0: self._purge_fetchmail_server(server, imap_server) except Exception: _logger.exception("General failure when trying to cleanup "