mirror of
https://github.com/coddingtonbear/django-mailbox.git
synced 2026-07-09 22:38:19 +02:00
Removing receiver for incoming 'message received' signal in management command; enumerate through incoming messages instead.
This commit is contained in:
parent
413b60e35f
commit
e8550b3797
2 changed files with 7 additions and 8 deletions
|
|
@ -1,8 +1,6 @@
|
|||
from django.core.management.base import BaseCommand
|
||||
from django.dispatch import receiver
|
||||
|
||||
from django_mailbox.models import Mailbox
|
||||
from django_mailbox.signals import message_received
|
||||
|
||||
class Command(BaseCommand):
|
||||
def handle(self, *args, **options):
|
||||
|
|
@ -11,8 +9,9 @@ class Command(BaseCommand):
|
|||
mailboxes = mailboxes.filter(name = ' '.join(args))
|
||||
for mailbox in mailboxes:
|
||||
self.stdout.write('Gathering messages for %s\n' % mailbox.name)
|
||||
mailbox.get_new_mail()
|
||||
|
||||
@receiver(message_received)
|
||||
def incoming_message(self, sender, message, **kwargs):
|
||||
self.stdout.write('Received %s\n' % message.subject)
|
||||
messages = mailbox.get_new_mail()
|
||||
for message in messages:
|
||||
self.stdout.write('Recieved %s (from %s)' % (
|
||||
message.subject,
|
||||
message.from_address
|
||||
))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue