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 8 years ago

Last modified 8 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:
Cc:

Description

I am migrating an app from 1.0.2.2 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
 try:
     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:
     pass
+try: # not available in 0.3
+    from sqlalchemy import Text, UnicodeText
+except ImportError:
+    UnicodeText = Text = type(None)
 
 [dispatch.generic()]
 def sacommand(command, args):

Change History

comment:1 Changed 8 years ago by gsakkis

  • Milestone changed from 1.1 to 1.0.x bugfix

comment:2 Changed 8 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.