Whitespace and formatting cleanup.
* Removed trailing whitespace * Line length < 80 where possible * Honor conventions on number of blank lines * Honor conventions about spaces around :, =
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user