From 4e5ebac6a0aff3a23a82cd8358ed11b3fd819b37 Mon Sep 17 00:00:00 2001 From: Luke Sneeringer Date: Fri, 12 Dec 2014 13:43:23 -0600 Subject: [PATCH] Nicer error on bad arguments to user_info. --- awx/main/management/commands/user_info.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/awx/main/management/commands/user_info.py b/awx/main/management/commands/user_info.py index 7c35719ad6..3a92a2ee3c 100644 --- a/awx/main/management/commands/user_info.py +++ b/awx/main/management/commands/user_info.py @@ -11,10 +11,18 @@ class Command(BaseCommand): """A command that reports whether a username exists within the system or not. """ - def handle(self, username, **options): + def handle(self, *args, **options): """Print out information about the user to the console.""" + # Sanity check: There should be one and exactly one positional + # argument. + if len(args) != 1: + raise CommandError('This command requires one positional argument ' + '(a username).') + + # Get the user. try: + username = args[0] user = User.objects.get(username=username) # Print a cute header.