aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/gmg_commands
diff options
context:
space:
mode:
Diffstat (limited to 'mediagoblin/gmg_commands')
-rw-r--r--mediagoblin/gmg_commands/__init__.py3
-rw-r--r--mediagoblin/gmg_commands/import_export.py7
-rw-r--r--mediagoblin/gmg_commands/migrate.py4
-rw-r--r--mediagoblin/gmg_commands/users.py7
4 files changed, 10 insertions, 11 deletions
diff --git a/mediagoblin/gmg_commands/__init__.py b/mediagoblin/gmg_commands/__init__.py
index 0071c65b..b3f69ccc 100644
--- a/mediagoblin/gmg_commands/__init__.py
+++ b/mediagoblin/gmg_commands/__init__.py
@@ -28,7 +28,7 @@ SUBCOMMAND_MAP = {
'setup': 'mediagoblin.gmg_commands.migrate:migrate_parser_setup',
'func': 'mediagoblin.gmg_commands.migrate:migrate',
'help': 'Apply all unapplied bulk migrations to the database'},
- 'adduser':{
+ 'adduser': {
'setup': 'mediagoblin.gmg_commands.users:adduser_parser_setup',
'func': 'mediagoblin.gmg_commands.users:adduser',
'help': 'Creates an user'},
@@ -80,4 +80,3 @@ def main_cli():
if __name__ == '__main__':
main_cli()
-
diff --git a/mediagoblin/gmg_commands/import_export.py b/mediagoblin/gmg_commands/import_export.py
index 05edbfc8..962e545c 100644
--- a/mediagoblin/gmg_commands/import_export.py
+++ b/mediagoblin/gmg_commands/import_export.py
@@ -91,7 +91,7 @@ def _import_database(db, args):
args.mongorestore_path,
'-d', db.name,
os.path.join(args._cache_path['database'], db.name)])
-
+
p.wait()
_log.info('...Database imported')
@@ -229,7 +229,8 @@ def env_export(args):
'''
if args.cache_path:
if os.path.exists(args.cache_path):
- _log.error('The cache directory must not exist before you run this script')
+ _log.error('The cache directory must not exist '
+ 'before you run this script')
_log.error('Cache directory: {0}'.format(args.cache_path))
return False
@@ -245,7 +246,7 @@ def env_export(args):
globa_config, app_config = setup_global_and_app_config(args.conf_file)
setup_storage()
-
+
connection, db = setup_connection_and_db_from_config(
app_config, use_pymongo=True)
diff --git a/mediagoblin/gmg_commands/migrate.py b/mediagoblin/gmg_commands/migrate.py
index 1a597188..e6dd6f78 100644
--- a/mediagoblin/gmg_commands/migrate.py
+++ b/mediagoblin/gmg_commands/migrate.py
@@ -55,13 +55,13 @@ def migrate(args):
for collection, index_name in removed_indexes:
print "Removed index '%s' in collection '%s'" % (
index_name, collection)
-
+
# Migrate
print "\n== Applying migrations... =="
migration_manager.migrate_new(
pre_callback=_print_started_migration,
post_callback=_print_finished_migration)
-
+
# Add new indexes
print "\n== Adding new indexes... =="
new_indexes = db_util.add_new_indexes(db)
diff --git a/mediagoblin/gmg_commands/users.py b/mediagoblin/gmg_commands/users.py
index 5421907d..3fda0e32 100644
--- a/mediagoblin/gmg_commands/users.py
+++ b/mediagoblin/gmg_commands/users.py
@@ -41,7 +41,7 @@ def adduser(args):
db = mg_globals.database
users_with_username = \
db.User.find({
- 'username': args.username.lower()
+ 'username': args.username.lower(),
}).count()
if users_with_username:
@@ -74,7 +74,7 @@ def makeadmin(args):
db = mg_globals.database
- user = db.User.one({'username':unicode(args.username.lower())})
+ user = db.User.one({'username': unicode(args.username.lower())})
if user:
user['is_admin'] = True
user.save()
@@ -100,11 +100,10 @@ def changepw(args):
db = mg_globals.database
- user = db.User.one({'username':unicode(args.username.lower())})
+ user = db.User.one({'username': unicode(args.username.lower())})
if user:
user['pw_hash'] = auth_lib.bcrypt_gen_password_hash(args.password)
user.save()
print 'Password successfully changed'
else:
print 'The user doesn\'t exist'
-