Remove obsolete tl_user check
This commit is contained in:
parent
5aae0f8326
commit
fe65ec2696
|
@ -81,7 +81,9 @@ def requires_lexicon(command):
|
||||||
return augmented_command
|
return augmented_command
|
||||||
|
|
||||||
USER_ARGS = ['--user']
|
USER_ARGS = ['--user']
|
||||||
USER_KWARGS = {'metavar': 'USER', 'dest': 'user',
|
USER_KWARGS = {
|
||||||
|
'metavar': 'USER',
|
||||||
|
'dest': 'user',
|
||||||
'help': 'Specify a user to operate on'}
|
'help': 'Specify a user to operate on'}
|
||||||
def requires_user(command):
|
def requires_user(command):
|
||||||
"""
|
"""
|
||||||
|
@ -100,18 +102,19 @@ def requires_user(command):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# Verify user argument in execute pass
|
# Verify user argument in execute pass
|
||||||
base_val = (hasattr(cmd_args, "tl_user")
|
val = ((hasattr(cmd_args, "user")
|
||||||
and getattr(cmd_args, "tl_user"))
|
|
||||||
subp_val = (hasattr(cmd_args, "user")
|
|
||||||
and getattr(cmd_args, "user"))
|
and getattr(cmd_args, "user"))
|
||||||
val = subp_val or base_val or None
|
or None)
|
||||||
if not val:
|
if not val:
|
||||||
from amanuensis.config import logger
|
from amanuensis.config import logger
|
||||||
logger.error("This command requires specifying a user")
|
logger.error("This command requires specifying a user")
|
||||||
return -1
|
return -1
|
||||||
from amanuensis.user import UserModel
|
from amanuensis.user import UserModel
|
||||||
cmd_args.user = UserModel.by(name=val)
|
cmd_args.user = UserModel.by(name=val) #TODO catch specific exceptions
|
||||||
# TODO more thorough verification of argument val
|
if cmd_args.user is None:
|
||||||
|
from amanuensis.config import logger
|
||||||
|
logger.error('Could not find user "{}"'.format(val))
|
||||||
|
return -1
|
||||||
return command(cmd_args)
|
return command(cmd_args)
|
||||||
|
|
||||||
augmented_command.__dict__['wrapper'] = True
|
augmented_command.__dict__['wrapper'] = True
|
||||||
|
|
Loading…
Reference in New Issue