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 #2057 (closed defect: fixed)

Opened 11 years ago

Last modified 11 years ago

1.0.7 breaks SA 0.3 compatibility

Reported by: gsakkis Owned by: faide
Priority: normal Milestone: 1.0.x bugfix
Component: TurboGears Version: 1.0.7
Severity: normal Keywords:


I am migrating an app from to 1.0.7 and I hit a NameError? on commands/sacommand.py; the reason is sqlalchemy.Text and sqlalchemy.UnicodeText? were added in SA 0.4. The docs claim that "TurboGears 1.0.4 and newer supports both SA 0.4 and 0.3 (requiring at least 0.3.10).", so either the docs or the code is wrong. Below is a minimal fix; feel free to make it cleaner if necessary.

--- sacommand.py        
+++ TurboGears-1.0.7-py2.5.egg/turbogears/command/sacommand.py  
@@ -3,10 +3,14 @@
 from turbogears.util import get_model
     from sqlalchemy import MetaData, exceptions, Table
-    from sqlalchemy import String, Unicode, Text, UnicodeText
+    from sqlalchemy import String, Unicode
     from turbogears.database import metadata, get_engine
 except ImportError:
+try: # not available in 0.3
+    from sqlalchemy import Text, UnicodeText
+except ImportError:
+    UnicodeText = Text = type(None)
 def sacommand(command, args):

Change History

comment:1 Changed 11 years ago by gsakkis

  • Milestone changed from 1.1 to 1.0.x bugfix

comment:2 Changed 11 years ago by chrisz

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

Good catch; in fact it didn't even work with SA < 0.4.3, so I have fixed this (in r5859) for TG 1.1 and 1.5 as well, since they currently require only SA >= 0.4.0.

Note: See TracTickets for help on using tickets.