TG-59 : Ajout de l'API UserAPI + passage du role en VARCHAR

This commit is contained in:
Clément ARNAUDEAU
2017-03-14 10:14:11 +01:00
parent c7ac46ee5a
commit b6ca3dbdc8
6 changed files with 106 additions and 11 deletions

View File

@ -37,7 +37,8 @@ def new_alchemy_encoder(revisit_self=False, fields_to_expand=[]):
# is this field another SQLalchemy object, or a list of SQLalchemy objects?
if isinstance(val.__class__, DeclarativeMeta) or (
isinstance(val, list) and len(val) > 0 and isinstance(val[0].__class__, DeclarativeMeta)):
isinstance(val, list) and len(val) > 0 and isinstance(val[0].__class__,
DeclarativeMeta)):
# unless we're expanding this field, stop here
if field not in fields_to_expand:
# not expanding this field: set it to None and continue
@ -51,3 +52,8 @@ def new_alchemy_encoder(revisit_self=False, fields_to_expand=[]):
return json.JSONEncoder.default(self, obj)
return AlchemyEncoder
def checkParams(wanted, args):
inter = [elt for elt in wanted if elt in args]
return len(inter) == len(wanted)