Hello community, here is the log from the commit of package python-South for openSUSE:Factory checked in at 2014-03-15 07:47:56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-South (Old) and /work/SRC/openSUSE:Factory/.python-South.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-South" Changes: -------- --- /work/SRC/openSUSE:Factory/python-South/python-South.changes 2013-10-25 11:32:47.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.python-South.new/python-South.changes 2014-03-15 07:47:57.000000000 +0100 @@ -1,0 +2,9 @@ +Thu Mar 13 14:07:11 UTC 2014 - [email protected] + +- Update to version 0.8.4 + + Django 1.6 compatibility + + Timezone-aware DateTimeFields no longer issue warnings + + Fixture loading issues fixed + + Various database backend related issues fixed + +------------------------------------------------------------------- Old: ---- South-0.8.2.tar.gz New: ---- South-0.8.4.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-South.spec ++++++ --- /var/tmp/diff_new_pack.cHc5pR/_old 2014-03-15 07:47:57.000000000 +0100 +++ /var/tmp/diff_new_pack.cHc5pR/_new 2014-03-15 07:47:57.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-South # -# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: python-South -Version: 0.8.2 +Version: 0.8.4 Release: 0 Url: http://south.aeracode.org/ Summary: South: Migrations for Django ++++++ South-0.8.2.tar.gz -> South-0.8.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/South-0.8.2/PKG-INFO new/South-0.8.4/PKG-INFO --- old/South-0.8.2/PKG-INFO 2013-08-09 16:49:51.000000000 +0200 +++ new/South-0.8.4/PKG-INFO 2013-11-21 11:39:01.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: South -Version: 0.8.2 +Version: 0.8.4 Summary: South: Migrations for Django Home-page: http://south.aeracode.org/ Author: Andrew Godwin & Andy McCurdy diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/South-0.8.2/South.egg-info/PKG-INFO new/South-0.8.4/South.egg-info/PKG-INFO --- old/South-0.8.2/South.egg-info/PKG-INFO 2013-08-09 16:49:50.000000000 +0200 +++ new/South-0.8.4/South.egg-info/PKG-INFO 2013-11-21 11:39:01.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: South -Version: 0.8.2 +Version: 0.8.4 Summary: South: Migrations for Django Home-page: http://south.aeracode.org/ Author: Andrew Godwin & Andy McCurdy diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/South-0.8.2/South.egg-info/SOURCES.txt new/South-0.8.4/South.egg-info/SOURCES.txt --- old/South-0.8.2/South.egg-info/SOURCES.txt 2013-08-09 16:49:51.000000000 +0200 +++ new/South-0.8.4/South.egg-info/SOURCES.txt 2013-11-21 11:39:01.000000000 +0100 @@ -1,4 +1,5 @@ README +setup.cfg setup.py South.egg-info/PKG-INFO South.egg-info/SOURCES.txt @@ -11,6 +12,7 @@ south/modelsinspector.py south/orm.py south/signals.py +south/test_shim.py south/v2.py south/creator/__init__.py south/creator/actions.py @@ -54,6 +56,7 @@ south/tests/__init__.py south/tests/autodetection.py south/tests/db.py +south/tests/db_firebird.py south/tests/db_mysql.py south/tests/freezer.py south/tests/inspector.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/South-0.8.2/setup.cfg new/South-0.8.4/setup.cfg --- old/South-0.8.2/setup.cfg 2013-08-09 16:49:51.000000000 +0200 +++ new/South-0.8.4/setup.cfg 2013-11-21 11:39:01.000000000 +0100 @@ -1,3 +1,6 @@ +[wheel] +universal = 1 + [egg_info] tag_build = tag_date = 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/South-0.8.2/south/__init__.py new/South-0.8.4/south/__init__.py --- old/South-0.8.2/south/__init__.py 2013-08-09 16:43:29.000000000 +0200 +++ new/South-0.8.4/south/__init__.py 2013-11-21 11:38:28.000000000 +0100 @@ -2,7 +2,7 @@ South - Useable migrations for Django apps """ -__version__ = "0.8.2" +__version__ = "0.8.4" __authors__ = [ "Andrew Godwin <[email protected]>", "Andy McCurdy <[email protected]>" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/South-0.8.2/south/db/firebird.py new/South-0.8.4/south/db/firebird.py --- old/South-0.8.2/south/db/firebird.py 2013-08-09 16:41:11.000000000 +0200 +++ new/South-0.8.4/south/db/firebird.py 2013-11-13 13:13:59.000000000 +0100 @@ -81,11 +81,13 @@ @generic.invalidate_table_constraints def create_table(self, table_name, fields): - qn = self.quote_name(table_name) columns = [] autoinc_sql = '' for field_name, field in fields: + # avoid default values in CREATE TABLE statements (#925) + field._suppress_default = True + col = self.column_sql(table_name, field_name, field) if not col: continue @@ -95,8 +97,11 @@ field_name = field.db_column or field.column autoinc_sql = connection.ops.autoinc_sql(table_name, field_name) - sql = 'CREATE TABLE %s (%s);' % (qn, ', '.join([col for col in columns])) - self.execute(sql) + self.execute(self.create_table_sql % { + "table": self.quote_name(table_name), + "columns": ', '.join([col for col in columns if col]), + }) + if autoinc_sql: self.execute(autoinc_sql[0]) self.execute(autoinc_sql[1]) @@ -210,13 +215,17 @@ for stmt in field.post_create_sql(no_style(), table_name): self.add_deferred_sql(stmt) - # In 1.2 and above, you have to ask the DatabaseCreation stuff for it. - # This also creates normal indexes in 1.1. - if hasattr(self._get_connection().creation, "sql_indexes_for_field"): - # Make a fake model to pass in, with only db_table - model = self.mock_model("FakeModelForGISCreation", table_name) - for stmt in self._get_connection().creation.sql_indexes_for_field(model, field, no_style()): - self.add_deferred_sql(stmt) + # Avoid double index creation (#1317) + # Firebird creates an index implicity for each foreign key field + # sql_indexes_for_field tries to create an index for that field too + if not field.rel: + # In 1.2 and above, you have to ask the DatabaseCreation stuff for it. + # This also creates normal indexes in 1.1. + if hasattr(self._get_connection().creation, "sql_indexes_for_field"): + # Make a fake model to pass in, with only db_table + model = self.mock_model("FakeModelForGISCreation", table_name) + for stmt in self._get_connection().creation.sql_indexes_for_field(model, field, no_style()): + self.add_deferred_sql(stmt) if sql: return sql % sqlparams diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/South-0.8.2/south/db/mysql.py new/South-0.8.4/south/db/mysql.py --- old/South-0.8.2/south/db/mysql.py 2013-05-22 13:57:23.000000000 +0200 +++ new/South-0.8.4/south/db/mysql.py 2013-11-13 13:13:59.000000000 +0100 @@ -37,13 +37,16 @@ def _column_cp(self, table_name, column_old, column_new, *args, **opts): # Copy foreign key constraint try: - constraint = self._find_foreign_constraints(table_name, column_old)[0] - (ftable, fcolumn) = self._lookup_constraint_references(table_name, constraint) - if ftable and fcolumn: - fk_sql = self.foreign_key_sql( - table_name, column_new, ftable, fcolumn) - get_logger().debug("Foreign key SQL: " + fk_sql) - self.add_deferred_sql(fk_sql) + constraint = self._find_foreign_constraints( + table_name, column_old)[0] + refs = self._lookup_constraint_references(table_name, constraint) + if refs is not None: + (ftable, fcolumn) = refs + if ftable and fcolumn: + fk_sql = self.foreign_key_sql( + table_name, column_new, ftable, fcolumn) + get_logger().debug("Foreign key SQL: " + fk_sql) + self.add_deferred_sql(fk_sql) except IndexError: pass # No constraint exists so ignore except DryRunError: @@ -178,8 +181,12 @@ e.g. which storage engine (MySQL) or transaction serialisability level. """ cursor = self._get_connection().cursor() + if cursor.execute("SHOW variables WHERE Variable_Name='default_storage_engine';"): + engine_var = 'default_storage_engine' + else: + engine_var = 'storage_engine' if self._has_setting('STORAGE_ENGINE') and self._get_setting('STORAGE_ENGINE'): - cursor.execute("SET storage_engine=%s;" % self._get_setting('STORAGE_ENGINE')) + cursor.execute("SET %s=%s;" % (engine_var, self._get_setting('STORAGE_ENGINE'))) def start_transaction(self): super(DatabaseOperations, self).start_transaction() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/South-0.8.2/south/db/oracle.py new/South-0.8.4/south/db/oracle.py --- old/South-0.8.2/south/db/oracle.py 2013-08-09 16:41:11.000000000 +0200 +++ new/South-0.8.4/south/db/oracle.py 2013-11-13 13:13:59.000000000 +0100 @@ -87,11 +87,11 @@ for field_name, field in fields: field = self._field_sanity(field) - + # avoid default values in CREATE TABLE statements (#925) field._suppress_default = True - + col = self.column_sql(table_name, field_name, field) if not col: continue @@ -132,7 +132,7 @@ self.execute(sequence_sql) @generic.invalidate_table_constraints - def alter_column(self, table_name, name, field, explicit_name=True): + def alter_column(self, table_name, name, field, explicit_name=True, ignore_constraints=False): if self.dry_run: if self.debug: @@ -162,7 +162,7 @@ 'nullity': 'NOT NULL', 'default': 'NULL' } - if field.null: + if field.null: params['nullity'] = 'NULL' sql_templates = [ @@ -184,15 +184,21 @@ (self.alter_string_update_nulls_to_default, change_params(default="%s"), [field.get_default()]), ] - - # drop CHECK constraints. Make sure this is executed before the ALTER TABLE statements - # generated above, since those statements recreate the constraints we delete here. - check_constraints = self._constraints_affecting_columns(table_name, [name], "CHECK") - for constraint in check_constraints: - self.execute(self.delete_check_sql % { - 'table': self.quote_name(table_name), - 'constraint': self.quote_name(constraint), - }) + if not ignore_constraints: + # drop CHECK constraints. Make sure this is executed before the ALTER TABLE statements + # generated above, since those statements recreate the constraints we delete here. + check_constraints = self._constraints_affecting_columns(table_name, [name], "CHECK") + for constraint in check_constraints: + self.execute(self.delete_check_sql % { + 'table': self.quote_name(table_name), + 'constraint': self.quote_name(constraint), + }) + # Drop foreign constraints + try: + self.delete_foreign_key(qn, qn_col) + except ValueError: + # There weren't any + pass for sql_template, params, args in sql_templates: try: @@ -214,6 +220,19 @@ self._print_sql_error(exc, sql_template % params) raise + if not ignore_constraints: + # Add back FK constraints if needed + if field.rel: #and self.supports_foreign_keys: + self.add_deferred_sql( + self.foreign_key_sql( + qn[1:-1], # foreign_key_sql uses this as part of constraint name + qn_col[1:-1], # foreign_key_sql uses this as part of constraint name + field.rel.to._meta.db_table, + field.rel.to._meta.get_field(field.rel.field_name).column + ) + ) + + def _alter_column_lob_workaround(self, table_name, name, field): """ Oracle refuses to change a column type from/to LOB to/from a regular @@ -266,9 +285,9 @@ self.execute(sql) # Now, drop the default if we need to - if not keep_default and field.default is not None: + if field.default is not None: field.default = NOT_PROVIDED - self.alter_column(table_name, name, field, explicit_name=False) + self.alter_column(table_name, name, field, explicit_name=False, ignore_constraints=True) def delete_column(self, table_name, name): return super(DatabaseOperations, self).delete_column(self.quote_name(table_name), name) @@ -292,11 +311,11 @@ """ if isinstance(field, models.BooleanField) and field.has_default(): field.default = int(field.to_python(field.get_default())) - # On Oracle, empty strings are null - if isinstance(field, (models.CharField, models.TextField)): + # On Oracle, empty strings are null + if isinstance(field, (models.CharField, models.TextField)): field.null = field.empty_strings_allowed return field - + def _default_value_workaround(self, value): from datetime import date,time,datetime diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/South-0.8.2/south/db/sqlite3.py new/South-0.8.4/south/db/sqlite3.py --- old/South-0.8.2/south/db/sqlite3.py 2013-08-09 16:41:11.000000000 +0200 +++ new/South-0.8.4/south/db/sqlite3.py 2013-11-13 13:13:59.000000000 +0100 @@ -64,7 +64,7 @@ cursor = self._get_connection().cursor() # Get the index descriptions indexes = self._get_connection().introspection.get_indexes(cursor, table_name) - multi_indexes = self._get_multi_indexes(table_name) + standalone_indexes = self._get_standalone_indexes(table_name) # Work out new column defs. for column_info in self._get_full_table_description(self._get_connection(), cursor, table_name): name = column_info['name'] @@ -117,8 +117,9 @@ # Recreate multi-valued indexes # We can't do that before since it's impossible to rename indexes # and index name scope is global - self._make_multi_indexes(table_name, multi_indexes, renames=renames, deleted=deleted, uniques_deleted=uniques_deleted) - + self._make_standalone_indexes(table_name, standalone_indexes, renames=renames, deleted=deleted, uniques_deleted=uniques_deleted) + self.deferred_sql = [] # prevent double indexing + def _copy_data(self, src, dst, field_renames={}, added={}): "Used to copy data into a new table" # Make a list of all the fields to select @@ -149,32 +150,38 @@ )) def _create_unique(self, table_name, columns): - self.execute("CREATE UNIQUE INDEX %s ON %s(%s);" % ( - self.quote_name('%s_%s' % (table_name, '__'.join(columns))), + self._create_index(table_name, columns, True) + + def _create_index(self, table_name, columns, unique=False, index_name=None): + if index_name is None: + index_name = '%s_%s' % (table_name, '__'.join(columns)) + self.execute("CREATE %sINDEX %s ON %s(%s);" % ( + unique and "UNIQUE " or "", + self.quote_name(index_name), self.quote_name(table_name), ', '.join(self.quote_name(c) for c in columns), )) - def _get_multi_indexes(self, table_name): + def _get_standalone_indexes(self, table_name): indexes = [] cursor = self._get_connection().cursor() cursor.execute('PRAGMA index_list(%s)' % self.quote_name(table_name)) # seq, name, unique for index, unique in [(field[1], field[2]) for field in cursor.fetchall()]: - if not unique: - continue cursor.execute('PRAGMA index_info(%s)' % self.quote_name(index)) info = cursor.fetchall() - if len(info) == 1: + if len(info) == 1 and unique: + # This index is already specified in the CREATE TABLE columns + # specification continue columns = [] for field in info: columns.append(field[2]) - indexes.append(columns) + indexes.append((index, columns, unique)) return indexes - def _make_multi_indexes(self, table_name, indexes, deleted=[], renames={}, uniques_deleted=[]): - for index in indexes: + def _make_standalone_indexes(self, table_name, indexes, deleted=[], renames={}, uniques_deleted=[]): + for index_name, index, unique in indexes: columns = [] for name in index: @@ -188,9 +195,9 @@ name = renames[name] columns.append(name) - if columns and set(columns) != set(uniques_deleted): - self._create_unique(table_name, columns) - + if columns and (set(columns) != set(uniques_deleted) or not unique): + self._create_index(table_name, columns, unique, index_name) + def _column_sql_for_create(self, table_name, name, field, explicit_name=True): "Given a field and its name, returns the full type for the CREATE TABLE (without unique/pk)" field.set_attributes_from_name(name) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/South-0.8.2/south/exceptions.py new/South-0.8.4/south/exceptions.py --- old/South-0.8.2/south/exceptions.py 2013-05-22 13:15:34.000000000 +0200 +++ new/South-0.8.4/south/exceptions.py 2013-11-13 13:59:00.000000000 +0100 @@ -15,7 +15,10 @@ if self.exc_info: self.traceback = ''.join(format_exception(*self.exc_info)) else: - self.traceback = format_exc() + try: + self.traceback = format_exc() + except AttributeError: # Python3 when there is no previous exception + self.traceback = None def __str__(self): return ("While loading migration '%(migration)s':\n" @@ -24,6 +27,8 @@ class UnknownMigration(BrokenMigration): def __str__(self): + if not hasattr(self, "traceback"): + self.traceback = "" return ("Migration '%(migration)s' probably doesn't exist.\n" '%(traceback)s' % self.__dict__) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/South-0.8.2/south/management/commands/datamigration.py new/South-0.8.4/south/management/commands/datamigration.py --- old/South-0.8.2/south/management/commands/datamigration.py 2013-08-09 16:42:31.000000000 +0200 +++ new/South-0.8.4/south/management/commands/datamigration.py 2013-10-30 12:40:59.000000000 +0100 @@ -116,7 +116,7 @@ MIGRATION_TEMPLATE = """# -*- coding: utf-8 -*- -import datetime +from south.utils import datetime_utils as datetime from south.db import db from south.v2 import DataMigration from django.db import models diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/South-0.8.2/south/management/commands/schemamigration.py new/South-0.8.4/south/management/commands/schemamigration.py --- old/South-0.8.2/south/management/commands/schemamigration.py 2013-08-09 16:41:11.000000000 +0200 +++ new/South-0.8.4/south/management/commands/schemamigration.py 2013-10-30 12:40:59.000000000 +0100 @@ -210,7 +210,7 @@ MIGRATION_TEMPLATE = """# -*- coding: utf-8 -*- -import datetime +from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/South-0.8.2/south/migration/__init__.py new/South-0.8.4/south/migration/__init__.py --- old/South-0.8.2/south/migration/__init__.py 2012-12-30 17:58:27.000000000 +0100 +++ new/South-0.8.4/south/migration/__init__.py 2013-10-30 12:40:59.000000000 +0100 @@ -162,7 +162,7 @@ verbosity = int(verbosity) # Fire off the pre-migrate signal - pre_migrate.send(None, app=app_label) + pre_migrate.send(None, app=app_label, verbosity=verbosity, interactive=verbosity, db=database) # If there aren't any, quit quizically if not migrations: @@ -220,7 +220,7 @@ success = migrator.migrate_many(target, workplan, database) # Finally, fire off the post-migrate signal if success: - post_migrate.send(None, app=app_label) + post_migrate.send(None, app=app_label, verbosity=verbosity, interactive=verbosity, db=database) else: if verbosity: # Say there's nothing. @@ -232,4 +232,4 @@ migrator = LoadInitialDataMigrator(migrator=Forwards(verbosity=verbosity)) migrator.load_initial_data(target, db=database) # Send signal. - post_migrate.send(None, app=app_label) + post_migrate.send(None, app=app_label, verbosity=verbosity, interactive=verbosity, db=database) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/South-0.8.2/south/migration/migrators.py new/South-0.8.4/south/migration/migrators.py --- old/South-0.8.2/south/migration/migrators.py 2013-08-09 16:41:11.000000000 +0200 +++ new/South-0.8.4/south/migration/migrators.py 2013-11-21 11:34:02.000000000 +0100 @@ -9,6 +9,7 @@ from django.core.management import call_command from django.core.management.commands import loaddata from django.db import models +from django import VERSION as DJANGO_VERSION import south.db from south import exceptions @@ -113,11 +114,14 @@ return self.run_migration(migration, database) - def send_ran_migration(self, migration): + def send_ran_migration(self, migration, database): ran_migration.send(None, app=migration.app_label(), migration=migration, - method=self.__class__.__name__.lower()) + method=self.__class__.__name__.lower(), + verbosity=self.verbosity, + interactive=self.interactive, + db=database) def migrate(self, migration, database): """ @@ -127,7 +131,7 @@ migration_name = migration.name() self.print_status(migration) result = self.run(migration, database) - self.send_ran_migration(migration) + self.send_ran_migration(migration, database) return result def migrate_many(self, target, migrations, database): @@ -205,13 +209,19 @@ class LoadInitialDataMigrator(MigratorWrapper): - + def load_initial_data(self, target, db='default'): if target is None or target != target.migrations[-1]: return # Load initial data, if we ended up at target if self.verbosity: print(" - Loading initial data for %s." % target.app_label()) + if DJANGO_VERSION < (1, 6): + self.pre_1_6(target, db) + else: + self.post_1_6(target, db) + + def pre_1_6(self, target, db): # Override Django's get_apps call temporarily to only load from the # current app old_get_apps = models.get_apps @@ -224,6 +234,21 @@ models.get_apps = old_get_apps loaddata.get_apps = old_get_apps + def post_1_6(self, target, db): + import django.db.models.loading + ## build a new 'AppCache' object with just the app we care about. + old_cache = django.db.models.loading.cache + new_cache = django.db.models.loading.AppCache() + new_cache.get_apps = lambda: [new_cache.get_app(target.app_label())] + + ## monkeypatch + django.db.models.loading.cache = new_cache + try: + call_command('loaddata', 'initial_data', verbosity=self.verbosity, database=db) + finally: + ## unmonkeypatch + django.db.models.loading.cache = old_cache + def migrate_many(self, target, migrations, database): migrator = self._migrator result = migrator.__class__.migrate_many(migrator, target, migrations, database) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/South-0.8.2/south/modelsinspector.py new/South-0.8.4/south/modelsinspector.py --- old/South-0.8.2/south/modelsinspector.py 2013-05-23 09:45:48.000000000 +0200 +++ new/South-0.8.4/south/modelsinspector.py 2013-10-30 12:40:59.000000000 +0100 @@ -164,6 +164,7 @@ "^django\.db", "^django\.contrib\.contenttypes\.generic", "^django\.contrib\.localflavor", + "^django_localflavor_\w\w", ] # Regexes of ignored fields (custom fields which look like fields, but have no column behind them) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/South-0.8.2/south/signals.py new/South-0.8.4/south/signals.py --- old/South-0.8.2/south/signals.py 2010-06-20 17:33:36.000000000 +0200 +++ new/South-0.8.4/south/signals.py 2013-10-30 12:40:59.000000000 +0100 @@ -6,13 +6,13 @@ from django.conf import settings # Sent at the start of the migration of an app -pre_migrate = Signal(providing_args=["app"]) +pre_migrate = Signal(providing_args=["app", "verbosity", "interactive", "db"]) # Sent after each successful migration of an app -post_migrate = Signal(providing_args=["app"]) +post_migrate = Signal(providing_args=["app", "verbosity", "interactive", "db"]) # Sent after each run of a particular migration in a direction -ran_migration = Signal(providing_args=["app","migration","method"]) +ran_migration = Signal(providing_args=["app", "migration", "method", "verbosity", "interactive", "db"]) # Compatibility code for django.contrib.auth # Is causing strange errors, removing for now (we might need to fix up orm first) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/South-0.8.2/south/test_shim.py new/South-0.8.4/south/test_shim.py --- old/South-0.8.2/south/test_shim.py 1970-01-01 01:00:00.000000000 +0100 +++ new/South-0.8.4/south/test_shim.py 2013-10-30 12:40:59.000000000 +0100 @@ -0,0 +1,6 @@ +""" +This file is needed as 1.6 only finds tests in files labelled test_*, +and ignores tests/__init__.py. +""" + +from south.tests import * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/South-0.8.2/south/tests/__init__.py new/South-0.8.4/south/tests/__init__.py --- old/South-0.8.2/south/tests/__init__.py 2012-12-22 11:12:15.000000000 +0100 +++ new/South-0.8.4/south/tests/__init__.py 2013-11-13 13:13:59.000000000 +0100 @@ -101,6 +101,7 @@ if not skiptest: from south.tests.db import * from south.tests.db_mysql import * + from south.tests.db_firebird import * from south.tests.logic import * from south.tests.autodetection import * from south.tests.logger import * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/South-0.8.2/south/tests/autodetection.py new/South-0.8.4/south/tests/autodetection.py --- old/South-0.8.2/south/tests/autodetection.py 2012-07-08 12:02:15.000000000 +0200 +++ new/South-0.8.4/south/tests/autodetection.py 2013-11-13 13:59:00.000000000 +0100 @@ -7,6 +7,12 @@ from south.orm import FakeORM from south.v2 import SchemaMigration +try: + from django.utils.six.moves import reload_module +except ImportError: + # Older django, no python3 support + reload_module = reload + class TestComparison(unittest.TestCase): """ @@ -338,7 +344,8 @@ complete_apps = ['non_managed'] - from non_managed import models as dummy_import_to_force_loading_models # TODO: Does needing this indicate a bug in MokeyPatcher? + from non_managed import models as dummy_import_to_force_loading_models # TODO: Does needing this indicate a bug in MokeyPatcher? + reload_module(dummy_import_to_force_loading_models) # really force... migrations = Migrations("non_managed") initial_orm = FakeORM(InitialMigration, "non_managed") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/South-0.8.2/south/tests/db.py new/South-0.8.4/south/tests/db.py --- old/South-0.8.2/south/tests/db.py 2013-08-09 16:41:11.000000000 +0200 +++ new/South-0.8.4/south/tests/db.py 2013-11-13 14:03:05.000000000 +0100 @@ -762,8 +762,9 @@ ('spam', models.BooleanField(default=False)) ]) - db.add_column("test_add_unique_fk", "mock1", models.ForeignKey(db.mock_model('Mock', 'mock'), null=True, unique=True)) - db.add_column("test_add_unique_fk", "mock2", models.OneToOneField(db.mock_model('Mock', 'mock'), null=True)) + db.add_column("test_add_unique_fk", "mock1", models.ForeignKey(db.mock_model('User', 'auth_user'), null=True, unique=True)) + db.add_column("test_add_unique_fk", "mock2", models.OneToOneField(db.mock_model('User', 'auth_user'), null=True)) + db.execute_deferred_sql() db.delete_table("test_add_unique_fk") @@ -879,6 +880,34 @@ db.alter_column("test_make_fk_null", "foreik_id", models.ForeignKey(User, null=True)) db.execute_deferred_sql() + def test_change_foreign_key_target(self): + # Tables for FK to target + User = db.mock_model(model_name='User', db_table='auth_user', db_tablespace='', pk_field_name='id', pk_field_type=models.AutoField, pk_field_args=[], pk_field_kwargs={}) + db.create_table("test_fk_changed_target", [ + ('eggs', models.IntegerField(primary_key=True)), + ]) + Egg = db.mock_model(model_name='Egg', db_table='test_fk_changed_target', db_tablespace='', pk_field_name='eggs', pk_field_type=models.AutoField, pk_field_args=[], pk_field_kwargs={}) + # Table with a foreign key to the wrong table + db.create_table("test_fk_changing", [ + ('egg', models.ForeignKey(User, null=True)), + ]) + db.execute_deferred_sql() + + # Change foreign key pointing + db.alter_column("test_fk_changing", "egg_id", models.ForeignKey(Egg, null=True)) + db.execute_deferred_sql() + + # Test that it is pointing at the right table now + try: + non_user_id = db.execute("SELECT MAX(id) FROM auth_user")[0][0] + 1 + except (TypeError, IndexError): + # Got a "None" or no records, treat as 0 + non_user_id = 17 + db.execute("INSERT INTO test_fk_changed_target (eggs) VALUES (%s)", [non_user_id]) + db.execute("INSERT INTO test_fk_changing (egg_id) VALUES (%s)", [non_user_id]) + db.commit_transaction() + db.start_transaction() # The test framework expects tests to end in transaction + def test_alter_double_indexed_column(self): # Table for FK to target User = db.mock_model(model_name='User', db_table='auth_user', db_tablespace='', pk_field_name='id', pk_field_type=models.AutoField, pk_field_args=[], pk_field_kwargs={}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/South-0.8.2/south/tests/db_firebird.py new/South-0.8.4/south/tests/db_firebird.py --- old/South-0.8.2/south/tests/db_firebird.py 1970-01-01 01:00:00.000000000 +0100 +++ new/South-0.8.4/south/tests/db_firebird.py 2013-11-13 13:59:00.000000000 +0100 @@ -0,0 +1,39 @@ +from django.db import models + +from south.db import db +from south.tests import unittest, skipUnless + + +class FirebirdTests(unittest.TestCase): + + """ + Tests firebird related issues + """ + + def setUp(self): + print('=' * 80) + print('Begin Firebird test') + + def tearDown(self): + print('End Firebird test') + print('=' * 80) + + @skipUnless(db.backend_name == "firebird", "Firebird-only test") + def test_firebird_double_index_creation_1317(self): + """ + Tests foreign key creation, especially uppercase (see #61) + """ + Test = db.mock_model(model_name='Test', + db_table='test5a', + db_tablespace='', + pk_field_name='ID', + pk_field_type=models.AutoField, + pk_field_args=[] + ) + db.create_table("test5a", [('ID', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True))]) + db.create_table("test5b", [ + ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), + ('UNIQUE', models.ForeignKey(Test)), + ]) + db.execute_deferred_sql() + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/South-0.8.2/south/v2.py new/South-0.8.4/south/v2.py --- old/South-0.8.2/south/v2.py 2010-10-30 11:37:02.000000000 +0200 +++ new/South-0.8.4/south/v2.py 2013-10-30 12:40:59.000000000 +0100 @@ -9,7 +9,9 @@ def gf(self, field_name): "Gets a field by absolute reference." - return ask_for_it_by_name(field_name) + field = ask_for_it_by_name(field_name) + field.model = FakeModel + return field class SchemaMigration(BaseMigration): pass @@ -17,3 +19,7 @@ class DataMigration(BaseMigration): # Data migrations shouldn't be dry-run no_dry_run = True + +class FakeModel(object): + "Fake model so error messages on fields don't explode" + pass -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
