Ticket #13760: 13760-3.diff

File 13760-3.diff, 12.4 KB (added by claudep, 3 years ago)

Rebased against trunk (once again)

  • django/core/management/commands/createcachetable.py

    commit 80718040e4370e721b6b3c38654760eab70dac0e
    Author: Claude Paroz <claude@2xlibre.net>
    Date:   Thu Oct 13 22:16:11 2011 +0200
    
        Remove duplicate defaults in management commands
    
    diff --git a/django/core/management/commands/createcachetable.py b/django/core/management/commands/createcachetable.py
    index 90172b6..a6628a0 100644
    a b class Command(LabelCommand): 
    1818    requires_model_validation = False
    1919
    2020    def handle_label(self, tablename, **options):
    21         alias = options.get('database', DEFAULT_DB_ALIAS)
     21        alias = options.get('database')
    2222        connection = connections[alias]
    2323        fields = (
    2424            # "key" is a reserved word in MySQL, so use "cache_key" instead.
  • django/core/management/commands/dbshell.py

    diff --git a/django/core/management/commands/dbshell.py b/django/core/management/commands/dbshell.py
    index a6b5427..7465920 100644
    a b class Command(BaseCommand): 
    1616    requires_model_validation = False
    1717
    1818    def handle(self, **options):
    19         connection = connections[options.get('database', DEFAULT_DB_ALIAS)]
     19        connection = connections[options.get('database')]
    2020        try:
    2121            connection.client.runshell()
    2222        except OSError:
  • django/core/management/commands/dumpdata.py

    diff --git a/django/core/management/commands/dumpdata.py b/django/core/management/commands/dumpdata.py
    index 0426d19..1622929 100644
    a b class Command(BaseCommand): 
    3030    def handle(self, *app_labels, **options):
    3131        from django.db.models import get_app, get_apps, get_model
    3232
    33         format = options.get('format','json')
    34         indent = options.get('indent',None)
    35         using = options.get('database', DEFAULT_DB_ALIAS)
    36         excludes = options.get('exclude',[])
    37         show_traceback = options.get('traceback', False)
    38         use_natural_keys = options.get('use_natural_keys', False)
    39         use_base_manager = options.get('use_base_manager', False)
     33        format = options.get('format')
     34        indent = options.get('indent')
     35        using = options.get('database')
     36        excludes = options.get('exclude')
     37        show_traceback = options.get('traceback')
     38        use_natural_keys = options.get('use_natural_keys')
     39        use_base_manager = options.get('use_base_manager')
    4040
    4141        excluded_apps = set()
    4242        excluded_models = set()
  • django/core/management/commands/flush.py

    diff --git a/django/core/management/commands/flush.py b/django/core/management/commands/flush.py
    index 0fe2779..6d0f14e 100644
    a b class Command(NoArgsCommand): 
    2323           're-executed, and the initial_data fixture will be re-installed.')
    2424
    2525    def handle_noargs(self, **options):
    26         db = options.get('database', DEFAULT_DB_ALIAS)
     26        db = options.get('database')
    2727        connection = connections[db]
    28         verbosity = int(options.get('verbosity', 1))
     28        verbosity = int(options.get('verbosity'))
    2929        interactive = options.get('interactive')
    3030
    3131        self.style = no_style()
  • django/core/management/commands/inspectdb.py

    diff --git a/django/core/management/commands/inspectdb.py b/django/core/management/commands/inspectdb.py
    index 90272db..76073c7 100644
    a b class Command(NoArgsCommand): 
    2525            raise CommandError("Database inspection isn't supported for the currently selected database backend.")
    2626
    2727    def handle_inspection(self, options):
    28         connection = connections[options.get('database', DEFAULT_DB_ALIAS)]
     28        connection = connections[options.get('database')]
    2929
    3030        table2model = lambda table_name: table_name.title().replace('_', '').replace(' ', '').replace('-', '')
    3131
  • django/core/management/commands/loaddata.py

    diff --git a/django/core/management/commands/loaddata.py b/django/core/management/commands/loaddata.py
    index 7b0e30f..356e2d0 100644
    a b class Command(BaseCommand): 
    3434    )
    3535
    3636    def handle(self, *fixture_labels, **options):
    37         using = options.get('database', DEFAULT_DB_ALIAS)
     37        using = options.get('database')
    3838
    3939        connection = connections[using]
    4040        self.style = no_style()
    4141
    42         verbosity = int(options.get('verbosity', 1))
    43         show_traceback = options.get('traceback', False)
     42        verbosity = int(options.get('verbosity'))
     43        show_traceback = options.get('traceback')
    4444
    4545        # commit is a stealth option - it isn't really useful as
    4646        # a command line option, but it can be useful when invoking
  • django/core/management/commands/runserver.py

    diff --git a/django/core/management/commands/runserver.py b/django/core/management/commands/runserver.py
    index 2e693e7..a0d2af5 100644
    a b class Command(BaseRunserverCommand): 
    140140        Serves admin media like old-school (deprecation pending).
    141141        """
    142142        handler = super(Command, self).get_handler(*args, **options)
    143         return AdminMediaHandler(handler, options.get('admin_media_path', ''))
     143        return AdminMediaHandler(handler, options.get('admin_media_path'))
  • django/core/management/commands/sql.py

    diff --git a/django/core/management/commands/sql.py b/django/core/management/commands/sql.py
    index 582bc8e..59b2e77 100644
    a b class Command(AppCommand): 
    1616    output_transaction = True
    1717
    1818    def handle_app(self, app, **options):
    19         return u'\n'.join(sql_create(app, self.style, connections[options.get('database', DEFAULT_DB_ALIAS)])).encode('utf-8')
     19        return u'\n'.join(sql_create(app, self.style, connections[options.get('database')])).encode('utf-8')
  • django/core/management/commands/sqlall.py

    diff --git a/django/core/management/commands/sqlall.py b/django/core/management/commands/sqlall.py
    index 8f3a38e..ab702bf 100644
    a b class Command(AppCommand): 
    1616    output_transaction = True
    1717
    1818    def handle_app(self, app, **options):
    19         return u'\n'.join(sql_all(app, self.style, connections[options.get('database', DEFAULT_DB_ALIAS)])).encode('utf-8')
     19        return u'\n'.join(sql_all(app, self.style, connections[options.get('database')])).encode('utf-8')
  • django/core/management/commands/sqlclear.py

    diff --git a/django/core/management/commands/sqlclear.py b/django/core/management/commands/sqlclear.py
    index c7e3a5e..b8f4913 100644
    a b class Command(AppCommand): 
    1616    output_transaction = True
    1717
    1818    def handle_app(self, app, **options):
    19         return u'\n'.join(sql_delete(app, self.style, connections[options.get('database', DEFAULT_DB_ALIAS)])).encode('utf-8')
     19        return u'\n'.join(sql_delete(app, self.style, connections[options.get('database')])).encode('utf-8')
  • django/core/management/commands/sqlcustom.py

    diff --git a/django/core/management/commands/sqlcustom.py b/django/core/management/commands/sqlcustom.py
    index d206b04..6a98456 100644
    a b class Command(AppCommand): 
    1616    output_transaction = True
    1717
    1818    def handle_app(self, app, **options):
    19         return u'\n'.join(sql_custom(app, self.style, connections[options.get('database', DEFAULT_DB_ALIAS)])).encode('utf-8')
     19        return u'\n'.join(sql_custom(app, self.style, connections[options.get('database')])).encode('utf-8')
  • django/core/management/commands/sqlflush.py

    diff --git a/django/core/management/commands/sqlflush.py b/django/core/management/commands/sqlflush.py
    index 004f0a5..19054fb 100644
    a b class Command(NoArgsCommand): 
    1616    output_transaction = True
    1717
    1818    def handle_noargs(self, **options):
    19         return u'\n'.join(sql_flush(self.style, connections[options.get('database', DEFAULT_DB_ALIAS)], only_django=True)).encode('utf-8')
     19        return u'\n'.join(sql_flush(self.style, connections[options.get('database')], only_django=True)).encode('utf-8')
  • django/core/management/commands/sqlindexes.py

    diff --git a/django/core/management/commands/sqlindexes.py b/django/core/management/commands/sqlindexes.py
    index c889f03..bf55b0d 100644
    a b class Command(AppCommand): 
    1717    output_transaction = True
    1818
    1919    def handle_app(self, app, **options):
    20         return u'\n'.join(sql_indexes(app, self.style, connections[options.get('database', DEFAULT_DB_ALIAS)])).encode('utf-8')
     20        return u'\n'.join(sql_indexes(app, self.style, connections[options.get('database')])).encode('utf-8')
  • django/core/management/commands/sqlreset.py

    diff --git a/django/core/management/commands/sqlreset.py b/django/core/management/commands/sqlreset.py
    index 13f40de..976b848 100644
    a b class Command(AppCommand): 
    1717    output_transaction = True
    1818
    1919    def handle_app(self, app, **options):
    20         return u'\n'.join(sql_reset(app, self.style, connections[options.get('database', DEFAULT_DB_ALIAS)])).encode('utf-8')
     20        return u'\n'.join(sql_reset(app, self.style, connections[options.get('database')])).encode('utf-8')
  • django/core/management/commands/sqlsequencereset.py

    diff --git a/django/core/management/commands/sqlsequencereset.py b/django/core/management/commands/sqlsequencereset.py
    index aaab38b..6460f00 100644
    a b class Command(AppCommand): 
    1616    output_transaction = True
    1717
    1818    def handle_app(self, app, **options):
    19         connection = connections[options.get('database', DEFAULT_DB_ALIAS)]
     19        connection = connections[options.get('database')]
    2020        return u'\n'.join(connection.ops.sequence_reset_sql(self.style, models.get_models(app, include_auto_created=True))).encode('utf-8')
  • django/core/management/commands/syncdb.py

    diff --git a/django/core/management/commands/syncdb.py b/django/core/management/commands/syncdb.py
    index 4383c34..a9d803a 100644
    a b class Command(NoArgsCommand): 
    2222
    2323    def handle_noargs(self, **options):
    2424
    25         verbosity = int(options.get('verbosity', 1))
     25        verbosity = int(options.get('verbosity'))
    2626        interactive = options.get('interactive')
    27         show_traceback = options.get('traceback', False)
     27        show_traceback = options.get('traceback')
    2828
    2929        # Stealth option -- 'load_initial_data' is used by the testing setup
    3030        # process to disable initial fixture loading.
    class Command(NoArgsCommand): 
    5151                if not msg.startswith('No module named') or 'management' not in msg:
    5252                    raise
    5353
    54         db = options.get('database', DEFAULT_DB_ALIAS)
     54        db = options.get('database')
    5555        connection = connections[db]
    5656        cursor = connection.cursor()
    5757
  • django/core/management/commands/test.py

    diff --git a/django/core/management/commands/test.py b/django/core/management/commands/test.py
    index 1b3f2be..2a6dbfc 100644
    a b class Command(BaseCommand): 
    4646        from django.test.utils import get_runner
    4747
    4848        TestRunner = get_runner(settings, options.get('testrunner'))
    49         options['verbosity'] = int(options.get('verbosity', 1))
    50         options.setdefault('interactive', True)
    51         options.setdefault('failfast', False)
     49        options['verbosity'] = int(options.get('verbosity'))
    5250
    5351        test_runner = TestRunner(**options)
    5452        failures = test_runner.run_tests(test_labels)
  • django/core/management/commands/testserver.py

    diff --git a/django/core/management/commands/testserver.py b/django/core/management/commands/testserver.py
    index 3f62e57..2e0d8e4 100644
    a b class Command(BaseCommand): 
    2121        from django.core.management import call_command
    2222        from django.db import connection
    2323
    24         verbosity = int(options.get('verbosity', 1))
    25         interactive = options.get('interactive', True)
     24        verbosity = int(options.get('verbosity'))
     25        interactive = options.get('interactive')
    2626        addrport = options.get('addrport')
    2727
    2828        # Create a test database.
Back to Top