From: Christopher Allan Webber Date: Thu, 16 May 2013 21:56:20 +0000 (-0500) Subject: Fixing bug in dbupdate where it would explode on plugin that is missing MODELS or... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=0ae38290488e39f2b3d0ec1248f0b78a6dceeba6;p=mediagoblin.git 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! --- 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(