Loading django/contrib/sessions/management/commands/clearsessions.py +3 −3 Original line number Diff line number Diff line from importlib import import_module from django.conf import settings from django.core.management.base import NoArgsCommand from django.core.management.base import BaseCommand class Command(NoArgsCommand): class Command(BaseCommand): help = "Can be run as a cronjob or directly to clean out expired sessions (only with the database backend at the moment)." def handle_noargs(self, **options): def handle(self, **options): engine = import_module(settings.SESSION_ENGINE) try: engine.SessionStore.clear_expired() Loading django/contrib/staticfiles/management/commands/collectstatic.py +7 −5 Original line number Diff line number Diff line Loading @@ -4,7 +4,8 @@ import os from collections import OrderedDict from django.core.files.storage import FileSystemStorage from django.core.management.base import CommandError, NoArgsCommand from django.core.management.base import CommandError, BaseCommand from django.core.management.color import no_style from django.utils.encoding import smart_text from django.utils.six.moves import input Loading @@ -12,7 +13,7 @@ from django.contrib.staticfiles.finders import get_finders from django.contrib.staticfiles.storage import staticfiles_storage class Command(NoArgsCommand): class Command(BaseCommand): """ Command that allows to copy or symlink static files from different locations to the settings.STATIC_ROOT. Loading @@ -21,12 +22,13 @@ class Command(NoArgsCommand): requires_system_checks = False def __init__(self, *args, **kwargs): super(NoArgsCommand, self).__init__(*args, **kwargs) super(BaseCommand, self).__init__(*args, **kwargs) self.copied_files = [] self.symlinked_files = [] self.unmodified_files = [] self.post_processed_files = [] self.storage = staticfiles_storage self.style = no_style() try: self.storage.path('') except NotImplementedError: Loading Loading @@ -79,7 +81,7 @@ class Command(NoArgsCommand): """ Perform the bulk of the work of collectstatic. Split off from handle_noargs() to facilitate testing. Split off from handle() to facilitate testing. """ if self.symlink and not self.local: raise CommandError("Can't symlink to a remote destination.") Loading Loading @@ -130,7 +132,7 @@ class Command(NoArgsCommand): 'post_processed': self.post_processed_files, } def handle_noargs(self, **options): def handle(self, **options): self.set_options(**options) message = ['\n'] Loading django/core/management/base.py +8 −0 Original line number Diff line number Diff line Loading @@ -603,6 +603,14 @@ class NoArgsCommand(BaseCommand): """ args = '' def __init__(self): warnings.warn( "NoArgsCommand class is deprecated and will be removed in Django 2.0. " "Use BaseCommand instead, which takes no arguments by default.", RemovedInDjango20Warning ) super(NoArgsCommand, self).__init__() def handle(self, *args, **options): if args: raise CommandError("Command doesn't accept any arguments") Loading django/core/management/commands/diffsettings.py +3 −3 Original line number Diff line number Diff line from django.core.management.base import NoArgsCommand from django.core.management.base import BaseCommand def module_to_dict(module, omittable=lambda k: k.startswith('_')): Loading @@ -6,7 +6,7 @@ def module_to_dict(module, omittable=lambda k: k.startswith('_')): return dict((k, repr(v)) for k, v in module.__dict__.items() if not omittable(k)) class Command(NoArgsCommand): class Command(BaseCommand): help = """Displays differences between the current settings.py and Django's default settings. Settings that don't appear in the defaults are followed by "###".""" Loading @@ -18,7 +18,7 @@ class Command(NoArgsCommand): help='Display all settings, regardless of their value. ' 'Default values are prefixed by "###".') def handle_noargs(self, **options): def handle(self, **options): # Inspired by Postfix's "postconf -n". from django.conf import settings, global_settings Loading django/core/management/commands/flush.py +3 −3 Original line number Diff line number Diff line Loading @@ -4,14 +4,14 @@ from importlib import import_module from django.apps import apps from django.db import connections, router, transaction, DEFAULT_DB_ALIAS from django.core.management import call_command from django.core.management.base import NoArgsCommand, CommandError from django.core.management.base import BaseCommand, CommandError from django.core.management.color import no_style from django.core.management.sql import sql_flush, emit_post_migrate_signal from django.utils.six.moves import input from django.utils import six class Command(NoArgsCommand): class Command(BaseCommand): help = ('Removes ALL DATA from the database, including data added during ' 'migrations. Unmigrated apps will also have their initial_data ' 'fixture reloaded. Does not achieve a "fresh install" state.') Loading @@ -26,7 +26,7 @@ class Command(NoArgsCommand): dest='load_initial_data', default=True, help='Tells Django not to load any initial data after database synchronization.') def handle_noargs(self, **options): def handle(self, **options): database = options.get('database') connection = connections[database] verbosity = options.get('verbosity') Loading Loading
django/contrib/sessions/management/commands/clearsessions.py +3 −3 Original line number Diff line number Diff line from importlib import import_module from django.conf import settings from django.core.management.base import NoArgsCommand from django.core.management.base import BaseCommand class Command(NoArgsCommand): class Command(BaseCommand): help = "Can be run as a cronjob or directly to clean out expired sessions (only with the database backend at the moment)." def handle_noargs(self, **options): def handle(self, **options): engine = import_module(settings.SESSION_ENGINE) try: engine.SessionStore.clear_expired() Loading
django/contrib/staticfiles/management/commands/collectstatic.py +7 −5 Original line number Diff line number Diff line Loading @@ -4,7 +4,8 @@ import os from collections import OrderedDict from django.core.files.storage import FileSystemStorage from django.core.management.base import CommandError, NoArgsCommand from django.core.management.base import CommandError, BaseCommand from django.core.management.color import no_style from django.utils.encoding import smart_text from django.utils.six.moves import input Loading @@ -12,7 +13,7 @@ from django.contrib.staticfiles.finders import get_finders from django.contrib.staticfiles.storage import staticfiles_storage class Command(NoArgsCommand): class Command(BaseCommand): """ Command that allows to copy or symlink static files from different locations to the settings.STATIC_ROOT. Loading @@ -21,12 +22,13 @@ class Command(NoArgsCommand): requires_system_checks = False def __init__(self, *args, **kwargs): super(NoArgsCommand, self).__init__(*args, **kwargs) super(BaseCommand, self).__init__(*args, **kwargs) self.copied_files = [] self.symlinked_files = [] self.unmodified_files = [] self.post_processed_files = [] self.storage = staticfiles_storage self.style = no_style() try: self.storage.path('') except NotImplementedError: Loading Loading @@ -79,7 +81,7 @@ class Command(NoArgsCommand): """ Perform the bulk of the work of collectstatic. Split off from handle_noargs() to facilitate testing. Split off from handle() to facilitate testing. """ if self.symlink and not self.local: raise CommandError("Can't symlink to a remote destination.") Loading Loading @@ -130,7 +132,7 @@ class Command(NoArgsCommand): 'post_processed': self.post_processed_files, } def handle_noargs(self, **options): def handle(self, **options): self.set_options(**options) message = ['\n'] Loading
django/core/management/base.py +8 −0 Original line number Diff line number Diff line Loading @@ -603,6 +603,14 @@ class NoArgsCommand(BaseCommand): """ args = '' def __init__(self): warnings.warn( "NoArgsCommand class is deprecated and will be removed in Django 2.0. " "Use BaseCommand instead, which takes no arguments by default.", RemovedInDjango20Warning ) super(NoArgsCommand, self).__init__() def handle(self, *args, **options): if args: raise CommandError("Command doesn't accept any arguments") Loading
django/core/management/commands/diffsettings.py +3 −3 Original line number Diff line number Diff line from django.core.management.base import NoArgsCommand from django.core.management.base import BaseCommand def module_to_dict(module, omittable=lambda k: k.startswith('_')): Loading @@ -6,7 +6,7 @@ def module_to_dict(module, omittable=lambda k: k.startswith('_')): return dict((k, repr(v)) for k, v in module.__dict__.items() if not omittable(k)) class Command(NoArgsCommand): class Command(BaseCommand): help = """Displays differences between the current settings.py and Django's default settings. Settings that don't appear in the defaults are followed by "###".""" Loading @@ -18,7 +18,7 @@ class Command(NoArgsCommand): help='Display all settings, regardless of their value. ' 'Default values are prefixed by "###".') def handle_noargs(self, **options): def handle(self, **options): # Inspired by Postfix's "postconf -n". from django.conf import settings, global_settings Loading
django/core/management/commands/flush.py +3 −3 Original line number Diff line number Diff line Loading @@ -4,14 +4,14 @@ from importlib import import_module from django.apps import apps from django.db import connections, router, transaction, DEFAULT_DB_ALIAS from django.core.management import call_command from django.core.management.base import NoArgsCommand, CommandError from django.core.management.base import BaseCommand, CommandError from django.core.management.color import no_style from django.core.management.sql import sql_flush, emit_post_migrate_signal from django.utils.six.moves import input from django.utils import six class Command(NoArgsCommand): class Command(BaseCommand): help = ('Removes ALL DATA from the database, including data added during ' 'migrations. Unmigrated apps will also have their initial_data ' 'fixture reloaded. Does not achieve a "fresh install" state.') Loading @@ -26,7 +26,7 @@ class Command(NoArgsCommand): dest='load_initial_data', default=True, help='Tells Django not to load any initial data after database synchronization.') def handle_noargs(self, **options): def handle(self, **options): database = options.get('database') connection = connections[database] verbosity = options.get('verbosity') Loading