mirror of
https://github.com/coddingtonbear/django-mailbox.git
synced 2026-07-09 22:38:19 +02:00
Updated management command's argument handling for Django 1.8\+
It appears that Django switched from optparse to argparse in Django 1.8. In Django 1.10 it appears that the compatibility mode for optparse-style managemnt commands was removed, and thus these were broken https://docs.djangoproject.com/en/1.11/internals/deprecation/#deprecation-removed-in-1-10 https://docs.djangoproject.com/en/1.11/releases/1.8/#extending-management-command-arguments-through-command-option-list https://docs.djangoproject.com/en/1.8/howto/custom-management-commands/
This commit is contained in:
parent
e0687380a1
commit
7b536046a9
1 changed files with 7 additions and 2 deletions
|
|
@ -16,8 +16,13 @@ logging.basicConfig(level=logging.INFO)
|
|||
|
||||
|
||||
class Command(BaseCommand):
|
||||
args = "<[Mailbox Name (optional)]>"
|
||||
command = "Receive incoming mail via stdin"
|
||||
help = "Receive incoming mail via stdin"
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument(
|
||||
'mailbox_name',
|
||||
help="The name of the mailbox that will receive the message"
|
||||
)
|
||||
|
||||
def handle(self, mailbox_name=None, *args, **options):
|
||||
message = email.message_from_string(sys.stdin.read())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue