Commits

Anonymous committed 33741af

Updating signals to add more information to match post_sycndb signal of Django. Added verbosity, interactive and db arguments.

Comments (0)

Files changed (4)

 
 Sent just before South starts running migrations for an app.
 
-Provides one argument, ``app``, a string containing the app's label.
+Provides the following arguments,
+    ``app``
+        a string containing the app's label.
+
+    ``verbosity``
+        Indicates how much information manage.py is printing on screen. See the --verbosity flag for details.
+        Functions which listen for pre_migrate should adjust what they output to the screen based on the value of this argument.
+
+    ``interactive``
+        If interactive is True, it’s safe to prompt the user to input things on the command line.
+        If interactive is False, functions which listen for this signal should not try to prompt for anything.
+
+    ``db``
+        The alias of database on which a command will operate.
 
 
 post_migrate
 Sent just after South successfully finishes running migrations for an app. Note
 that if the migrations fail in the middle of executing, this will not get called.
 
-Provides one argument, ``app``, a string containing the app's label.
+Provides the following arguments,
+    ``app``
+        a string containing the app's label.
+
+    ``verbosity``
+        Indicates how much information manage.py is printing on screen. See the --verbosity flag for details.
+        Functions which listen for pre_migrate should adjust what they output to the screen based on the value of this argument.
+
+    ``interactive``
+        If interactive is True, it’s safe to prompt the user to input things on the command line.
+        If interactive is False, functions which listen for this signal should not try to prompt for anything.
+
+    ``db``
+        The alias of database on which a command will operate.
 
 
 ran_migration
 sent multiple times in one run of South, possibly hundreds of times if you
 have hundreds of migrations, and are doing a fresh install.
 
-Provides three arguments, ``app``, a string containing the app's label,
-``migration``, a Migration object, and ``method``, which is either
-``"forwards"`` or ``"backwards"``.
+Provides the following arguments,
+    ``app``
+        a string containing the app's label.
+
+    ``migration``
+        a Migration object,
+
+    ``method``
+        Either ``"forwards"`` or ``"backwards"``.
+
+    ``verbosity``
+        Indicates how much information manage.py is printing on screen. See the --verbosity flag for details.
+        Functions which listen for pre_migrate should adjust what they output to the screen based on the value of this argument.
+
+    ``interactive``
+        If interactive is True, it’s safe to prompt the user to input things on the command line.
+        If interactive is False, functions which listen for this signal should not try to prompt for anything.
+
+    ``db``
+        The alias of database on which a command will operate.

south/migration/__init__.py

 
     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:
         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.
             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)

south/migration/migrators.py

         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):
         """
         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):
 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)