Make sure MigrationManagers always get Unicode names.
authorBrett Smith <brettcsmith@brettcsmith.org>
Wed, 4 Jul 2012 14:54:44 +0000 (10:54 -0400)
committerBrett Smith <brettcsmith@brettcsmith.org>
Wed, 4 Jul 2012 14:54:44 +0000 (10:54 -0400)
If we fail to do this, SQLAlchemy complains that we're binding a
non-Unicode value to a Unicode column.

mediagoblin/gmg_commands/dbupdate.py
mediagoblin/tests/test_sql_migrations.py

index dc36be82bd3c606768f63d5bbe0f5e72aea8e180..1c48ff579597389b12f4e9eb08d8a43b79894899 100644 (file)
@@ -52,7 +52,7 @@ def gather_database_data(media_types):
 
     managed_dbdata.append(
         DatabaseData(
-            '__main__', MAIN_MODELS, MAIN_MIGRATIONS))
+            u'__main__', MAIN_MODELS, MAIN_MIGRATIONS))
 
     # Then get all registered media managers (eventually, plugins)
     for media_type in media_types:
index 507a77252607b92beaa3785b70814a6323fbda8a..7fea101c3a1a383d067206f3fccbf01949f54ed6 100644 (file)
@@ -561,7 +561,7 @@ def test_set1_to_set3():
 
     printer = CollectingPrinter()
     migration_manager = MigrationManager(
-        '__main__', SET1_MODELS, SET1_MIGRATIONS, Session(),
+        u'__main__', SET1_MODELS, SET1_MIGRATIONS, Session(),
         printer)
 
     # Check latest migration and database current migration
@@ -586,7 +586,7 @@ def test_set1_to_set3():
 
     # Try to "re-migrate" with same manager settings... nothing should happen
     migration_manager = MigrationManager(
-        '__main__', SET1_MODELS, SET1_MIGRATIONS, Session(),
+        u'__main__', SET1_MODELS, SET1_MIGRATIONS, Session(),
         printer)
     assert migration_manager.init_or_migrate() == None
 
@@ -668,7 +668,7 @@ def test_set1_to_set3():
     # isn't said to be updated yet
     printer = CollectingPrinter()
     migration_manager = MigrationManager(
-        '__main__', SET3_MODELS, SET3_MIGRATIONS, Session(),
+        u'__main__', SET3_MODELS, SET3_MIGRATIONS, Session(),
         printer)
 
     assert migration_manager.latest_migration == 7
@@ -694,7 +694,7 @@ def test_set1_to_set3():
     
     # Make sure version matches expected
     migration_manager = MigrationManager(
-        '__main__', SET3_MODELS, SET3_MIGRATIONS, Session(),
+        u'__main__', SET3_MODELS, SET3_MIGRATIONS, Session(),
         printer)
     assert migration_manager.latest_migration == 7
     assert migration_manager.database_current_migration == 7