diff --git a/.gitignore b/.gitignore index 6199f17..114e702 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *.pyc .pylero .pylarion +*.egg-info* diff --git a/src/pylero/base_polarion.py b/src/pylero/base_polarion.py index 53ded2a..55b019a 100644 --- a/src/pylero/base_polarion.py +++ b/src/pylero/base_polarion.py @@ -604,12 +604,16 @@ def _custom_getter(self, field_name): elif csm.get("is_array"): obj = [] # ArrayOf Polarion objects have a double list. - for inst in custom_fld.value[0]: - if csm["cls"]._cls_inner._id_field: - item_inst = csm["cls"]._cls_inner(suds_object=inst) - obj.append(getattr(item_inst, item_inst._id_field)) - else: - obj.append(csm["cls"]._cls_inner(suds_object=inst)) + if custom_fld.value: + for inst in custom_fld.value[0]: + if csm["cls"]._cls_inner._id_field: + item_inst = csm["cls"]._cls_inner( + suds_object=inst) + obj.append( + getattr(item_inst, item_inst._id_field)) + else: + obj.append(csm["cls"]._cls_inner( + suds_object=inst)) elif csm.get("cls"): obj = csm["cls"](suds_object=custom_fld.value) else: diff --git a/src/pylero/work_item.py b/src/pylero/work_item.py index c29fe41..07a42f0 100644 --- a/src/pylero/work_item.py +++ b/src/pylero/work_item.py @@ -1426,6 +1426,8 @@ def get_custom_fields(cls, project_id): None) cls._cls_suds_map[local_name]["is_custom"] = True cls._cls_suds_map[local_name]["control"] = cls._wi_type + if parse_type[1].startswith("Array"): + cls._cls_suds_map[local_name]["is_array"] = True if cft.required: cls._required_fields.append(local_name) cls._got_custom_fields = True