Django

Code

Changeset 9110

Show
Ignore:
Timestamp:
10/02/08 07:57:13 (3 months ago)
Author:
russellm
Message:

Promoted --verbosity to be a top level option for all management commands. Also added -v as a consistent short form of --verbosity. This is mostly to save Malcolm's poor arthritic fingers.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/core/management/base.py

    r9082 r9110  
    122122    # Metadata about this command. 
    123123    option_list = ( 
     124        make_option('-v', '--verbosity', action='store', dest='verbosity', default='1', 
     125            type='choice', choices=['0', '1', '2'], 
     126            help='Verbosity level; 0=minimal output, 1=normal output, 2=all output'), 
    124127        make_option('--settings', 
    125128            help='The Python path to a settings module, e.g. "myproject.settings.main". If this isn\'t provided, the DJANGO_SETTINGS_MODULE environment variable will be used.'), 
     
    210213                translation.activate('en-us') 
    211214            except ImportError, e: 
    212                 # If settings should be available, but aren't,  
     215                # If settings should be available, but aren't, 
    213216                # raise the error and quit. 
    214217                sys.stderr.write(self.style.ERROR(str('Error: %s\n' % e))) 
  • django/trunk/django/core/management/commands/flush.py

    r8223 r9110  
    55class Command(NoArgsCommand): 
    66    option_list = NoArgsCommand.option_list + ( 
    7         make_option('--verbosity', action='store', dest='verbosity', default='1', 
    8             type='choice', choices=['0', '1', '2'], 
    9             help='Verbosity level; 0=minimal output, 1=normal output, 2=all output'), 
    107        make_option('--noinput', action='store_false', dest='interactive', default=True, 
    118            help='Tells Django to NOT prompt the user for input of any kind.'), 
  • django/trunk/django/core/management/commands/loaddata.py

    r8336 r9110  
    1111 
    1212class Command(BaseCommand): 
    13     option_list = BaseCommand.option_list + ( 
    14         make_option('--verbosity', action='store', dest='verbosity', default='1', 
    15             type='choice', choices=['0', '1', '2'], 
    16             help='Verbosity level; 0=minimal output, 1=normal output, 2=all output'), 
    17     ) 
    1813    help = 'Installs the named fixture(s) in the database.' 
    1914    args = "fixture [fixture ...]" 
     
    2924        verbosity = int(options.get('verbosity', 1)) 
    3025        show_traceback = options.get('traceback', False) 
    31          
    32         # commit is a stealth option - it isn't really useful as  
     26 
     27        # commit is a stealth option - it isn't really useful as 
    3328        # a command line option, but it can be useful when invoking 
    34         # loaddata from within another script.  
     29        # loaddata from within another script. 
    3530        # If commit=True, loaddata will use its own transaction; 
    3631        # if commit=False, the data load SQL will become part of 
    3732        # the transaction in place when loaddata was invoked. 
    3833        commit = options.get('commit', True) 
    39          
     34 
    4035        # Keep a count of the installed objects and fixtures 
    4136        fixture_count = 0 
     
    152147            transaction.leave_transaction_management() 
    153148            return 
    154              
     149 
    155150        # If we found even one object in a fixture, we need to reset the 
    156151        # database sequences. 
     
    162157                for line in sequence_sql: 
    163158                    cursor.execute(line) 
    164          
     159 
    165160        if commit: 
    166161            transaction.commit() 
     
    173168            if verbosity > 0: 
    174169                print "Installed %d object(s) from %d fixture(s)" % (object_count, fixture_count) 
    175                  
     170 
    176171        # Close the DB connection. This is required as a workaround for an 
    177172        # edge case in MySQL: if the same connection is used to 
  • django/trunk/django/core/management/commands/makemessages.py

    r8576 r9110  
    171171        make_option('--domain', '-d', default='django', dest='domain', 
    172172            help='The domain of the message files (default: "django").'), 
    173         make_option('--verbosity', '-v', action='store', dest='verbosity', 
    174             default='1', type='choice', choices=['0', '1', '2'], 
    175             help='Verbosity level; 0=minimal output, 1=normal output, 2=all output'), 
    176173        make_option('--all', '-a', action='store_true', dest='all', 
    177174            default=False, help='Reexamines all source code and templates for new translation strings and updates all message files for all available languages.'), 
  • django/trunk/django/core/management/commands/syncdb.py

    r8296 r9110  
    1111class Command(NoArgsCommand): 
    1212    option_list = NoArgsCommand.option_list + ( 
    13         make_option('--verbosity', action='store', dest='verbosity', default='1', 
    14             type='choice', choices=['0', '1', '2'], 
    15             help='Verbosity level; 0=minimal output, 1=normal output, 2=all output'), 
    1613        make_option('--noinput', action='store_false', dest='interactive', default=True, 
    1714            help='Tells Django to NOT prompt the user for input of any kind.'), 
     
    4239                # can do this is to check the text of the exception. Note that 
    4340                # we're a bit broad in how we check the text, because different 
    44                 # Python implementations may not use the same text.  
     41                # Python implementations may not use the same text. 
    4542                # CPython uses the text "No module named management" 
    4643                # PyPy uses "No module named myproject.myapp.management" 
     
    10097        # to do at this point. 
    10198        emit_post_sync_signal(created_models, verbosity, interactive) 
    102          
     99 
    103100        # The connection may have been closed by a syncdb handler. 
    104101        cursor = connection.cursor() 
    105          
     102 
    106103        # Install custom SQL for the app (but only if this 
    107104        # is a model we've just created) 
  • django/trunk/django/core/management/commands/test.py

    r8046 r9110  
    55class Command(BaseCommand): 
    66    option_list = BaseCommand.option_list + ( 
    7         make_option('--verbosity', action='store', dest='verbosity', default='1', 
    8             type='choice', choices=['0', '1', '2'], 
    9             help='Verbosity level; 0=minimal output, 1=normal output, 2=all output'), 
    107        make_option('--noinput', action='store_false', dest='interactive', default=True, 
    118            help='Tells Django to NOT prompt the user for input of any kind.'), 
     
    2118        verbosity = int(options.get('verbosity', 1)) 
    2219        interactive = options.get('interactive', True) 
    23      
     20 
    2421        test_path = settings.TEST_RUNNER.split('.') 
    2522        # Allow for Python 2.5 relative paths 
  • django/trunk/django/core/management/commands/testserver.py

    r8296 r9110  
    55class Command(BaseCommand): 
    66    option_list = BaseCommand.option_list + ( 
    7         make_option('--verbosity', action='store', dest='verbosity', default='1', 
    8             type='choice', choices=['0', '1', '2'], 
    9             help='Verbosity level; 0=minimal output, 1=normal output, 2=all output'), 
    10         make_option('--addrport', action='store', dest='addrport',  
     7        make_option('--addrport', action='store', dest='addrport', 
    118            type='string', default='', 
    129            help='port number or ipaddr:port to run the server on'), 
  • django/trunk/docs/ref/django-admin.txt

    r8987 r9110  
    8686 
    8787Use ``--verbosity`` to specify the amount of notification and debug information 
    88 that ``django-admin.py`` should print to the console. 
    89  
    90     * ``0`` means no output. 
    91     * ``1`` means normal output (default). 
    92     * ``2`` means verbose output. 
    93  
     88that ``django-admin.py`` should print to the console. For more details, see the 
     89documentation for the :ref:`default options for django-admin.py <django-admin-verbosity>`. 
    9490 
    9591Available subcommands 
    9692===================== 
    9793 
    98 cleanup  
     94cleanup 
    9995------- 
    10096 
     
    123119    django-admin.py compilemessages --locale=br_PT 
    124120 
    125 createcachetable  
     121createcachetable 
    126122---------------- 
    127123 
     
    134130--------------- 
    135131 
    136 .. django-admin:: createsuperuser  
     132.. django-admin:: createsuperuser 
    137133 
    138134.. versionadded:: 1.0 
     
    183179 
    184180Displays differences between the current settings file and Django's default 
    185 settings.  
     181settings. 
    186182 
    187183Settings that don't appear in the defaults are followed by ``"###"``. For 
     
    368364    defer checking of row constraints until a transaction is committed. 
    369365 
    370 --verbosity 
    371 ~~~~~~~~~~~ 
    372  
    373 Use ``--verbosity`` to specify the amount of notification and debug information 
    374 that ``django-admin.py`` should print to the console. 
    375  
    376         * ``0`` means no output. 
    377         * ``1`` means normal output (default). 
    378         * ``2`` means verbose output. 
    379  
    380 Example usage:: 
    381  
    382     django-admin.py loaddata --verbosity=2 
    383  
    384366makemessages 
    385367------------ 
     
    434416Currently supported: 
    435417 
    436         * ``django`` for all ``*.py`` and ``*.html`` files (default)  
     418        * ``django`` for all ``*.py`` and ``*.html`` files (default) 
    437419        * ``djangojs`` for ``*.js`` files 
    438  
    439 --verbosity 
    440 ~~~~~~~~~~~ 
    441  
    442 Use ``--verbosity`` or ``-v`` to specify the amount of notification and debug 
    443 information that ``django-admin.py`` should print to the console. 
    444  
    445         * ``0`` means no output. 
    446         * ``1`` means normal output (default). 
    447         * ``2`` means verbose output. 
    448  
    449 Example usage:: 
    450  
    451     django-admin.py makemessages --verbosity=2 
    452420 
    453421reset <appname appname ...> 
     
    686654data files. 
    687655 
    688 --verbosity 
    689 ~~~~~~~~~~~ 
    690  
    691 Use ``--verbosity`` to specify the amount of notification and debug information 
    692 that ``django-admin.py`` should print to the console. 
    693  
    694         * ``0`` means no output. 
    695         * ``1`` means normal output (default). 
    696         * ``2`` means verbose output. 
    697  
    698 Example usage:: 
    699  
    700     django-admin.py syncdb --verbosity=2 
    701  
    702656--noinput 
    703657~~~~~~~~~ 
     
    719673"Are you sure?" confirmation messages. This is useful if ``django-admin.py`` 
    720674is being executed as an unattended, automated script. 
    721  
    722 --verbosity 
    723 ~~~~~~~~~~~ 
    724  
    725 Use ``--verbosity`` to specify the amount of notification and debug information 
    726 that ``django-admin.py`` should print to the console. 
    727  
    728         * ``0`` means no output. 
    729         * ``1`` means normal output (default). 
    730         * ``2`` means verbose output. 
    731  
    732 Example usage:: 
    733  
    734     django-admin.py test --verbosity=2 
    735675 
    736676testserver <fixture fixture ...> 
     
    794734    django-admin.py testserver --addrport 1.2.3.4:7000 test 
    795735 
    796 --verbosity 
    797 ~~~~~~~~~~~ 
    798  
    799 Use ``--verbosity`` to specify the amount of notification and debug information 
    800 that ``django-admin.py`` should print to the console. 
    801  
    802         * ``0`` means no output. 
    803         * ``1`` means normal output (default). 
    804         * ``2`` means verbose output. 
    805  
    806 Example usage:: 
    807  
    808     django-admin.py testserver --verbosity=2 
    809  
    810736validate 
    811737-------- 
     
    862788output a full stack trace whenever an exception is raised. 
    863789 
     790.. _django-admin-verbosity: 
     791 
     792--verbosity 
     793----------- 
     794 
     795Example usage:: 
     796 
     797    django-admin.py syncdb --verbosity 2 
     798 
     799Use ``--verbosity`` to specify the amount of notification and debug information 
     800that ``django-admin.py`` should print to the console. 
     801 
     802    * ``0`` means no output. 
     803    * ``1`` means normal output (default). 
     804    * ``2`` means verbose output. 
     805 
    864806Extra niceties 
    865807============== 
     
    888830 
    889831 
    890 See :ref:`howto-custom-management-commands` for how to add customized actions.  
     832See :ref:`howto-custom-management-commands` for how to add customized actions. 
  • django/trunk/docs/ref/signals.txt

    r8977 r9110  
    213213    ``verbosity`` 
    214214        Indicates how much information manage.py is printing on screen. See 
    215         the :djadminopt:`--verbosity`` flag for details. 
     215        the :djadminopt:`--verbosity` flag for details. 
    216216 
    217217        Functions which listen for :data:`post_syncdb` should adjust what they 
  • django/trunk/tests/runtests.py

    r8731 r9110  
    143143            extra_tests.append(InvalidModelTestCase(model_label)) 
    144144            try: 
    145                 # Invalid models are not working apps, so we cannot pass them into  
     145                # Invalid models are not working apps, so we cannot pass them into 
    146146                # the test runner with the other test_labels 
    147147                test_labels.remove(model_name) 
    148148            except ValueError: 
    149149                pass 
    150      
     150 
    151151    # Run the test suite, including the extra validation tests. 
    152152    from django.test.simple import run_tests