Use add_arguments over deprecated option_list

pull/2392/merge
Tim Heap 2016-03-23 17:26:32 +11:00 zatwierdzone przez Karl Hobley
rodzic 4ae35e7f03
commit 94e6c2bbea
3 zmienionych plików z 12 dodań i 28 usunięć

Wyświetl plik

@ -1,6 +1,5 @@
import functools
import operator
from optparse import make_option
from django.core.management.base import BaseCommand
from django.db import models
@ -12,13 +11,11 @@ from wagtail.wagtailcore.models import Page
class Command(BaseCommand):
help = "Checks for data integrity errors on the page tree, and fixes them where possible."
base_options = (
make_option(
def add_arguments(self, parser):
parser.add_argument(
'--noinput', action='store_false', dest='interactive', default=True,
help='If provided, any fixes requiring user interaction will be skipped.'
),
)
option_list = BaseCommand.option_list + base_options
help='If provided, any fixes requiring user interaction will be skipped.')
def numberlist_to_string(self, numberlist):
# Converts a list of numbers into a string

Wyświetl plik

@ -1,7 +1,6 @@
from __future__ import print_function
import json
from optparse import make_option
from django.core.management.base import BaseCommand
from django.utils import dateparse, timezone
@ -21,15 +20,10 @@ def revision_date_expired(r):
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option(
'--dryrun',
action='store_true',
dest='dryrun',
default=False,
help='Dry run -- don\'t change anything.'
),
)
def add_arguments(self, parser):
parser.add_argument(
'--dryrun', action='store_true', dest='dryrun', default=False,
help="Dry run -- dont't change anything.")
def handle(self, *args, **options):
dryrun = False

Wyświetl plik

@ -1,5 +1,3 @@
from optparse import make_option
from django.conf import settings
from django.core.management.base import BaseCommand
from django.db import transaction
@ -57,15 +55,10 @@ class Command(BaseCommand):
self.stdout.write(backend_name + ": Finishing rebuild")
rebuilder.finish()
option_list = BaseCommand.option_list + (
make_option(
'--backend',
action='store',
dest='backend_name',
default=None,
help="Specify a backend to update",
),
)
def add_arguments(self, parser):
parser.add_argument(
'--backend', action='store', dest='backend_name', default=None,
help="Specify a backend to update")
def handle(self, **options):
# Get object list