From 0ae38290488e39f2b3d0ec1248f0b78a6dceeba6 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Thu, 16 May 2013 16:56:20 -0500 Subject: [PATCH] Fixing bug in dbupdate where it would explode on plugin that is missing MODELS or MIGRATIONS The reason it blew up was because in the latter caught exception, it wouldn't set models/migrations to an empty set, so it would actually use the previous run's models/migrations! That's what we get for "leaky" variables on python for loops :) This commit sponsored by Pascal Diogo Antunes. Thank you! --- mediagoblin/gmg_commands/dbupdate.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mediagoblin/gmg_commands/dbupdate.py b/mediagoblin/gmg_commands/dbupdate.py index 32700c40..fa25ecb2 100644 --- a/mediagoblin/gmg_commands/dbupdate.py +++ b/mediagoblin/gmg_commands/dbupdate.py @@ -78,6 +78,7 @@ def gather_database_data(media_types, plugins): except AttributeError as exc: _log.warning('Could not find MODELS in {0}.models, have you \ forgotten to add it? ({1})'.format(plugin, exc)) + models = [] try: migrations = import_component('{0}.migrations:MIGRATIONS'.format( @@ -91,6 +92,7 @@ forgotten to add it? ({1})'.format(plugin, exc)) except AttributeError as exc: _log.debug('Cloud not find MIGRATIONS in {0}.migrations, have you \ forgotten to add it? ({1})'.format(plugin, exc)) + migrations = {} if models: managed_dbdata.append( -- 2.25.1