Ticket #38 (closed defect: fixed)

Opened 7 years ago

Last modified 16 months ago

Verbosity option has no fallback

Reported by: boyerchen@… Owned by: andrew
Priority: critical Milestone:
Component: commands Version: 0.6-pre
Keywords: Cc:


Since the verbose option was added, I can't call "migrate" by django.core.management.call_command('migrate', app_label, '0001') for example.

CronJob[<PeriodicJob: autoupdate [p=5]>]: status=-1, message=Upgrade failed: Traceback (most recent call last):
  File "/home/django/http80/march/htdocs/march/apps/base/libs/cron/cronjob.py", line 54, in run
    if UpgradeClient().upgrade():
  File "/home/django/http80/march/htdocs/march/glibs/upgradelib.py", line 93, in upgrade
  File "/home/django/http80/march/htdocs/march/glibs/upgradelib.py", line 167, in _run_upgrade
    _upgrade.main(settings.PROJECT_ROOT, working_dir=self.extract_path)
  File "/tmp/march_upgrade_11696/__init__.py", line 159, in main
  File "/tmp/march_upgrade_11696/__init__.py", line 71, in upgrade
  File "/tmp/march_upgrade_11696/__init__.py", line 119, in syncdb
  File "/home/django/http80/march/virtualenv/lib/python2.5/site-packages/Django-1.0.1.beta.1-py2.5.egg/django/core/management/__init__.py", line 158, in call_command
    return klass.execute(*args, **options)
  File "/home/django/http80/march/virtualenv/lib/python2.5/site-packages/Django-1.0.1.beta.1-py2.5.egg/django/core/management/base.py", line 219, in execute
    output = self.handle(*args, **options)
  File "/home/django/http80/march/virtualenv/lib/python2.5/site-packages/Django-1.0.1.beta.1-py2.5.egg/django/core/management/base.py", line 348, in handle
    return self.handle_noargs(**options)
  File "/home/django/http80/march/virtualenv/lib/python2.5/site-packages/South-0.3-py2.5.egg/south/management/commands/syncdb.py", line 43, in handle_noargs
    verbosity = int(options.get('verbosity'))
TypeError: int() argument must be a string or a number, not 'NoneType'

Didn't try this yet, but maybe int(options.get('verbosity', 0)) would be enough to fix it.

Change History

comment:1 Changed 7 years ago by boyerchen@…

Hm, took a look at my own source again, it was caused by call_command('syncdb'), but the idea above fixed it in fact for me.

Index: management/commands/syncdb.py
--- management/commands/syncdb.py       (revision 89)
+++ management/commands/syncdb.py       (working copy)
@@ -40,7 +40,7 @@
                 # This is a migrated app, leave it
-        verbosity = int(options.get('verbosity'))
+        verbosity = int(options.get('verbosity', 1))
         # Run syncdb on only the ones needed
         if verbosity > 0:
             print "Syncing..."

comment:2 Changed 7 years ago by andrew

  • Status changed from new to closed
  • Resolution set to fixed

Yup, that looks about right - good point. I've checked in [90], which fixes this and one in ./manage.py migrate - both default to 0, though, since I think that's a reasonable default to have.

Note: See TracTickets for help on using tickets.