mirror of
https://github.com/coddingtonbear/django-mailbox.git
synced 2026-07-09 22:38:19 +02:00
Fix getmail no logs
This commit is contained in:
parent
2948b1b1cc
commit
2e4db58e5c
1 changed files with 8 additions and 4 deletions
|
|
@ -14,24 +14,28 @@ class Command(BaseCommand):
|
|||
help = ""
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument('--logging', type=bool, default=True, dest='logging',
|
||||
help='Enable logging (default true)')
|
||||
parser.add_argument('-nl', '--nologs', action='store_true', default=False, dest='nologs',
|
||||
help='Disable logging (default False)')
|
||||
|
||||
def handle(self, *args, **options):
|
||||
mailboxes = Mailbox.active_mailboxes.all()
|
||||
logging = True
|
||||
if option['nologs']:
|
||||
logging = False
|
||||
|
||||
if args:
|
||||
mailboxes = mailboxes.filter(
|
||||
name=' '.join(args)
|
||||
)
|
||||
for mailbox in mailboxes:
|
||||
if options['logging']:
|
||||
if logging
|
||||
logger.info(
|
||||
'Gathering messages for %s',
|
||||
mailbox.name
|
||||
)
|
||||
messages = mailbox.get_new_mail()
|
||||
for message in messages:
|
||||
if options['logging']:
|
||||
if logging:
|
||||
logger.info(
|
||||
'Received %s (from %s)',
|
||||
message.subject,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue