Base attribute filtering on internal representation names

Instead on relying on the FriendlyName from metadatata, use the name
of the internal representation of an attribute in order to perform
filtering. Resolves #422
This commit is contained in:
Ioannis Kakavas
2017-06-12 16:57:28 +03:00
parent 9d0cc9cdb6
commit c24b47ceba

View File

@@ -79,10 +79,15 @@ def filter_on_attributes(ava, required=None, optional=None, acs=None,
def _match_attr_name(attr, ava):
try:
friendly_name = attr["friendly_name"]
except KeyError:
friendly_name = get_local_name(acs, attr["name"],
friendly_name = get_local_name(acs, attr["name"],
attr["name_format"])
except:
friendly_name = None
if not friendly_name:
try:
friendly_name = attr["friendly_name"]
except KeyError:
pass
_fn = _match(friendly_name, ava)
if not _fn: # In the unlikely case that someone has provided us with
@@ -91,6 +96,7 @@ def filter_on_attributes(ava, required=None, optional=None, acs=None,
return _fn
def _apply_attr_value_restrictions(attr, res, must=False):
try:
values = [av["text"] for av in attr["attribute_value"]]
@@ -105,7 +111,6 @@ def filter_on_attributes(ava, required=None, optional=None, acs=None,
return _filter_values(ava[_fn], values, must)
res = {}
if required is None:
required = []