forked from mirror/django-mailbox
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:
parent
c8751f0c9a
commit
505bc8d1c9
1 changed files with 3 additions and 1 deletions
|
|
@ -20,9 +20,11 @@ logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def get_new_mail(mailbox_admin, request, queryset):
|
def get_new_mail(mailbox_admin, request, queryset):
|
||||||
|
count = 0
|
||||||
for mailbox in queryset.all():
|
for mailbox in queryset.all():
|
||||||
logger.debug('Receiving mail for %s' % mailbox)
|
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')
|
get_new_mail.short_description = _('Get new mail')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue