1
0
Fork 0

Fix get_new_mail admin action.

Mailbox.get_new_mail returns a generator
which do not actually run if we do not iterate it.
This commit is contained in:
George Cheng 2020-07-26 04:55:46 +00:00
parent c8751f0c9a
commit 505bc8d1c9

View file

@ -20,9 +20,11 @@ logger = logging.getLogger(__name__)
def get_new_mail(mailbox_admin, request, queryset):
count = 0
for mailbox in queryset.all():
logger.debug('Receiving mail for %s' % mailbox)
mailbox.get_new_mail()
count += sum(1 for i in mailbox.get_new_mail())
logger.debug('Received %d %s.', count, 'mails' if count != 1 else 'mail')
get_new_mail.short_description = _('Get new mail')