Commit 732e42f9 authored by André Anjos's avatar André Anjos 💬 Committed by André Anjos

Use simpler validation

parent fe2f04c1
......@@ -180,8 +180,11 @@ def validate(args):
'''
valid_databases = ('fv3d', 'verafinger')
sch = schema.Schema({
'<database>': lambda n: n in ('fv3d', 'verafinger'),
'<database>': schema.And(lambda n: n in valid_databases,
error='<database> must be one of %s' % ', '.join(valid_databases)),
str: object, #ignores strings we don't care about
}, ignore_extra_keys=True)
......@@ -219,9 +222,6 @@ def main(user_input=None):
from ..configurations.fv3d import database as db
elif args['<database>'] == 'verafinger':
from ..configurations.verafinger import database as db
else:
raise schema.SchemaError('Database %s is not supported' % \
args['<database>'])
database_replacement = "%s/.bob_bio_databases.txt" % os.environ["HOME"]
db.replace_directories(database_replacement)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment