From: ayleph Date: Tue, 16 Sep 2014 22:29:09 +0000 (-0700) Subject: Modify deleteuser to fail gracefully X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=f0e795df82596e476d9f116d58012e563bb064a4;p=mediagoblin.git Modify deleteuser to fail gracefully bin/gmg deleteuser will produce a traceback error if you attempt to delete a user who does not exist. This commit provides a fix to allow deletuser to fail gracefully. This commit addresses https://issues.mediagoblin.org/ticket/969 --- diff --git a/mediagoblin/gmg_commands/users.py b/mediagoblin/gmg_commands/users.py index 71149497..d34f50e2 100644 --- a/mediagoblin/gmg_commands/users.py +++ b/mediagoblin/gmg_commands/users.py @@ -129,7 +129,7 @@ def deleteuser(args): db = mg_globals.database user = db.User.query.filter_by( - username=unicode(args.username.lower())).one() + username=unicode(args.username.lower())).first() if user: user.delete() print 'The user %s has been deleted' % args.username