aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/gmg_commands
diff options
context:
space:
mode:
Diffstat (limited to 'mediagoblin/gmg_commands')
-rw-r--r--mediagoblin/gmg_commands/import_export.py4
-rw-r--r--mediagoblin/gmg_commands/users.py14
2 files changed, 9 insertions, 9 deletions
diff --git a/mediagoblin/gmg_commands/import_export.py b/mediagoblin/gmg_commands/import_export.py
index 4ec17d47..1308f09e 100644
--- a/mediagoblin/gmg_commands/import_export.py
+++ b/mediagoblin/gmg_commands/import_export.py
@@ -67,7 +67,7 @@ def _import_media(db, args):
for entry in db.media_entries.find():
for name, path in entry['media_files'].items():
_log.info('Importing: {0} - {1}'.format(
- entry['title'],
+ entry.title,
name))
media_file = mg_globals.public_store.get_file(path, mode='wb')
@@ -209,7 +209,7 @@ def _export_media(db, args):
for entry in db.media_entries.find():
for name, path in entry['media_files'].items():
_log.info(u'Exporting {0} - {1}'.format(
- entry['title'],
+ entry.title,
name))
try:
mc_file = media_cache.get_file(path, mode='wb')
diff --git a/mediagoblin/gmg_commands/users.py b/mediagoblin/gmg_commands/users.py
index b437e839..4bfe30a5 100644
--- a/mediagoblin/gmg_commands/users.py
+++ b/mediagoblin/gmg_commands/users.py
@@ -50,11 +50,11 @@ def adduser(args):
else:
# Create the user
entry = db.User()
- entry['username'] = unicode(args.username.lower())
- entry['email'] = unicode(args.email)
- entry['pw_hash'] = auth_lib.bcrypt_gen_password_hash(args.password)
- entry['status'] = u'active'
- entry['email_verified'] = True
+ entry.username = unicode(args.username.lower())
+ entry.email = unicode(args.email)
+ entry.pw_hash = auth_lib.bcrypt_gen_password_hash(args.password)
+ entry.status = u'active'
+ entry.email_verified = True
entry.save(validate=True)
print "User created (and email marked as verified)"
@@ -73,7 +73,7 @@ def makeadmin(args):
user = db.User.one({'username': unicode(args.username.lower())})
if user:
- user['is_admin'] = True
+ user.is_admin = True
user.save()
print 'The user is now Admin'
else:
@@ -96,7 +96,7 @@ def changepw(args):
user = db.User.one({'username': unicode(args.username.lower())})
if user:
- user['pw_hash'] = auth_lib.bcrypt_gen_password_hash(args.password)
+ user.pw_hash = auth_lib.bcrypt_gen_password_hash(args.password)
user.save()
print 'Password successfully changed'
else: