Browse Source

Correct type for purge_days + better checks

pull/213/head
Matthieu Dietrich 9 years ago
parent
commit
694dbb4c94
  1. 8
      mail_cleanup/mail_cleanup.py

8
mail_cleanup/mail_cleanup.py

@ -80,7 +80,7 @@ class FetchmailServer(orm.Model):
_get_cleanup_conf, _get_cleanup_conf,
method=True, method=True,
string='Deletion days', string='Deletion days',
type="char",
type="integer",
multi='outgoing_mail_config', multi='outgoing_mail_config',
help="Number of days before removing an e-mail"), help="Number of days before removing an e-mail"),
} }
@ -146,12 +146,12 @@ class FetchmailServer(orm.Model):
context.update({'fetchmail_server_id': server.id, context.update({'fetchmail_server_id': server.id,
'server_type': server.type}) 'server_type': server.type})
imap_server = False imap_server = False
if server.type == 'imap' and server.cleanup_days > 0:
if server.type == 'imap':
try: try:
imap_server = server.connect() imap_server = server.connect()
if server.cleanup_days:
if server.cleanup_days > 0:
self._cleanup_fetchmail_server(server, imap_server) self._cleanup_fetchmail_server(server, imap_server)
if server.purge_days:
if server.purge_days > 0:
self._purge_fetchmail_server(server, imap_server) self._purge_fetchmail_server(server, imap_server)
except Exception: except Exception:
_logger.exception("General failure when trying to cleanup " _logger.exception("General failure when trying to cleanup "

Loading…
Cancel
Save