Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #459 (closed defect: fixed)

Opened 13 years ago

Last modified 12 years ago

tg-admin sql upgrade cryptic failure

Reported by: Max <ischenko@…> Owned by: anonymous
Priority: normal Milestone: 0.9
Component: SQLObject Version:
Severity: normal Keywords:
Cc:

Description

tg-admin sql upgrade command fails with an ugly traceback if no recorded version exists:

Traceback (most recent call last):
  File "C:\Python24\Scripts\tg-admin-script.py", line 7, in ?
    sys.exit(
  File "d:\projects\3rd-party\turbogears\turbogears\command\base.py", line 269, in main
    command.run()
  File "d:\projects\3rd-party\turbogears\turbogears\command\base.py", line 129, in run
    command.the_runner.run(sys.argv)
  File "c:\python24\lib\site-packages\sqlobject-0.7.1dev_r1534-py2.4.egg\sqlobject\manager\command.py", line 102, in run
    runner.run()
  File "c:\python24\lib\site-packages\sqlobject-0.7.1dev_r1534-py2.4.egg\sqlobject\manager\command.py", line 233, in run
    self.command()
  File "c:\python24\lib\site-packages\sqlobject-0.7.1dev_r1534-py2.4.egg\sqlobject\manager\command.py", line 839, in command
    create, constraints = cls.createTableSQL()
ValueError: too many values to unpack

That's not too user-friendly. Here's the patch

Index: sqlobject/manager/command.py
===================================================================
--- sqlobject/manager/command.py	(revision 1534)
+++ sqlobject/manager/command.py	(working copy)
@@ -1052,7 +1052,11 @@
         if self.options.upgrade_to:
             version_to = self.options.upgrade_to
         else:
-            version_to = os.path.basename(self.find_last_version())
+            fname = self.find_last_version()
+            if fname is None:
+                print "No version exists, use 'record' command to create one"
+                return
+            version_to = os.path.basename(fname)
         current = self.current_version()
         if v:
             print 'Current version: %s' % current

Change History

comment:1 Changed 13 years ago by anonymous

Submitted to SQLObject patch tracker,  issue page.

comment:2 Changed 13 years ago by ianb@…

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

Applied in r1593.

Note: See TracTickets for help on using tickets.