aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/gmg_commands
diff options
context:
space:
mode:
authorBoris Bobrov <breton@cynicmansion.ru>2015-11-01 09:26:39 +0900
committerChristopher Allan Webber <cwebber@dustycloud.org>2016-01-11 07:14:33 -0800
commit8da8c0ac2d1c20968165fcd0bc41d0b9f397593d (patch)
tree70ae0e053c485addab57c0096dbd9f6c41963dd6 /mediagoblin/gmg_commands
parent9bc8c8709dc7f7ff37efdcef2a5ce492985d7f95 (diff)
downloadmediagoblin-8da8c0ac2d1c20968165fcd0bc41d0b9f397593d.tar.lz
mediagoblin-8da8c0ac2d1c20968165fcd0bc41d0b9f397593d.tar.xz
mediagoblin-8da8c0ac2d1c20968165fcd0bc41d0b9f397593d.zip
Fix various style issues
Sorry, cannot look at them without urge to fix
Diffstat (limited to 'mediagoblin/gmg_commands')
-rw-r--r--mediagoblin/gmg_commands/dbupdate.py24
1 files changed, 13 insertions, 11 deletions
diff --git a/mediagoblin/gmg_commands/dbupdate.py b/mediagoblin/gmg_commands/dbupdate.py
index 31827cd0..342ee7eb 100644
--- a/mediagoblin/gmg_commands/dbupdate.py
+++ b/mediagoblin/gmg_commands/dbupdate.py
@@ -48,6 +48,8 @@ class DatabaseData(object):
def gather_database_data(plugins):
"""
+ Gather all database data relevant to the extensions installed.
+
Gather all database data relevant to the extensions we have
installed so we can do migrations and table initialization.
@@ -74,8 +76,8 @@ def gather_database_data(plugins):
models = []
except AttributeError as exc:
- _log.warning('Could not find MODELS in {0}.models, have you \
-forgotten to add it? ({1})'.format(plugin, exc))
+ _log.warning('Could not find MODELS in {0}.models, have you '
+ 'forgotten to add it? ({1})'.format(plugin, exc))
models = []
try:
@@ -88,12 +90,13 @@ forgotten to add it? ({1})'.format(plugin, exc))
migrations = {}
except AttributeError as exc:
- _log.debug('Could not find MIGRATIONS in {0}.migrations, have you \
-forgotten to add it? ({1})'.format(plugin, exc))
+ _log.debug('Could not find MIGRATIONS in {0}.migrations, have you'
+ 'forgotten to add it? ({1})'.format(plugin, exc))
migrations = {}
try:
- foundations = import_component('{0}.models:FOUNDATIONS'.format(plugin))
+ foundations = import_component(
+ '{0}.models:FOUNDATIONS'.format(plugin))
except ImportError as exc:
foundations = {}
except AttributeError as exc:
@@ -101,14 +104,13 @@ forgotten to add it? ({1})'.format(plugin, exc))
if models:
managed_dbdata.append(
- DatabaseData(plugin, models, foundations, migrations))
-
+ DatabaseData(plugin, models, foundations, migrations))
return managed_dbdata
def run_alembic_migrations(db, app_config, global_config):
- """Initializes a database and runs all Alembic migrations."""
+ """Initialize a database and runs all Alembic migrations."""
Session = sessionmaker(bind=db.engine)
manager = AlembicMigrationManager(Session())
manager.init_or_migrate()
@@ -121,7 +123,6 @@ def run_dbupdate(app_config, global_config):
Will also initialize or migrate all extensions (media types, and
in the future, plugins)
"""
-
# Set up the database
db = setup_connection_and_db_from_config(app_config, migrations=True)
# Run the migrations
@@ -134,7 +135,8 @@ def run_dbupdate(app_config, global_config):
def run_all_migrations(db, app_config, global_config):
- """
+ """Initialize or migrates a database.
+
Initializes or migrates a database that already has a
connection setup and also initializes or migrates all
extensions based on the config files.
@@ -144,7 +146,7 @@ def run_all_migrations(db, app_config, global_config):
"""
# Gather information from all media managers / projects
dbdatas = gather_database_data(
- list(global_config.get('plugins', {}).keys()))
+ list(global_config.get('plugins', {}).keys()))
Session = sessionmaker(bind=db.engine)