aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/gmg_commands
diff options
context:
space:
mode:
Diffstat (limited to 'mediagoblin/gmg_commands')
-rw-r--r--mediagoblin/gmg_commands/__init__.py5
-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, 11 insertions, 12 deletions
diff --git a/mediagoblin/gmg_commands/__init__.py b/mediagoblin/gmg_commands/__init__.py
index 10c30385..04187ff2 100644
--- a/mediagoblin/gmg_commands/__init__.py
+++ b/mediagoblin/gmg_commands/__init__.py
@@ -29,7 +29,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'},
@@ -68,7 +68,7 @@ def main_cli():
subparsers = parser.add_subparsers(help='sub-command help')
for command_name, command_struct in SUBCOMMAND_MAP.iteritems():
- if command_struct.has_key('help'):
+ if 'help' in command_struct:
subparser = subparsers.add_parser(
command_name, help=command_struct['help'])
else:
@@ -94,4 +94,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 78d30713..a46219a0 100644
--- a/mediagoblin/gmg_commands/import_export.py
+++ b/mediagoblin/gmg_commands/import_export.py
@@ -88,7 +88,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')
@@ -226,7 +226,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
@@ -242,7 +243,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 fad9b363..beea109d 100644
--- a/mediagoblin/gmg_commands/migrate.py
+++ b/mediagoblin/gmg_commands/migrate.py
@@ -53,13 +53,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 345c3e5c..4c4b0c1b 100644
--- a/mediagoblin/gmg_commands/users.py
+++ b/mediagoblin/gmg_commands/users.py
@@ -38,7 +38,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:
@@ -68,7 +68,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()
@@ -91,11 +91,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'
-