Let parser handle typing for deletuser command
authorJessica Tallon <jessica@megworld.co.uk>
Tue, 20 Jan 2015 10:49:24 +0000 (10:49 +0000)
committerJessica Tallon <jessica@megworld.co.uk>
Tue, 20 Jan 2015 12:24:13 +0000 (12:24 +0000)
mediagoblin/gmg_commands/users.py

index 63c48690efbb956a46e90c7c7bb15e47921d4577..158a1a2d9d1522ae5693d27a2383035ccc96447b 100644 (file)
@@ -124,7 +124,8 @@ def changepw(args):
 def deleteuser_parser_setup(subparser):
     subparser.add_argument(
         'username',
-        help="Username to delete")
+        help="Username to delete",
+        type=six.text_type)
 
 
 def deleteuser(args):
@@ -132,8 +133,7 @@ def deleteuser(args):
 
     db = mg_globals.database
 
-    user = db.User.query.filter_by(
-        username=unicode(args.username.lower())).first()
+    user = db.User.query.filter_by(username=args.username.lower()).first()
     if user:
         user.delete()
         print('The user %s has been deleted' % args.username)