jesper-raemaekers / python-polarion

A Python package to access the Polarion WSDL API.
MIT License
56 stars 35 forks source link

setCustomField() with EnumType raises zeep Exception #136

Closed CloudyAtSES closed 1 year ago

CloudyAtSES commented 1 year ago

Hi,

I'm currently experiencing a zeep exception when trying to set a custom field with an EnumType or ArrayOfEnumType. The Code:

test_field = client.EnumOptionIdType(id='test')
workitem.setCustomField("test", test_field) 

My Traceback looks like this:

Traceback (most recent call last):
  File "C:\projects\x\x\playground.py", line 41, in <module>
    workitem.setCustomField("testMethod", field_value)
  File "C:\Users\\AppData\Local\Programs\Python\Python311\Lib\site-packages\polarion\base\custom_fields.py", line 37, in setCustomField
    self.save()
  File "C:\Users\\AppData\Local\Programs\Python\Python311\Lib\site-packages\polarion\workitem.py", line 748, in save
    service.updateWorkItem(updated_item)
  File "C:\Users\\AppData\Local\Programs\Python\Python311\Lib\site-packages\zeep\proxy.py", line 46, in __call__
    return self._proxy._binding.send(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\\AppData\Local\Programs\Python\Python311\Lib\site-packages\zeep\wsdl\bindings\soap.py", line 135, in send
    return self.process_reply(client, operation_obj, response)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\\AppData\Local\Programs\Python\Python311\Lib\site-packages\zeep\wsdl\bindings\soap.py", line 229, in process_reply
    return self.process_error(doc, operation)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\\AppData\Local\Programs\Python\Python311\Lib\site-packages\zeep\wsdl\bindings\soap.py", line 329, in process_error
    raise Fault(
zeep.exceptions.Fault: java.lang.IllegalArgumentException: Model collections are not allowed to contain null items.

This Exception Traceback also occurs if a custom Enum field gets retrieved and then set with the API.

CloudyAtSES commented 1 year ago

This was a fault caused by me. I didn't check whether the customField i wan't to set is a SingleOption Field or a MultiOptionField.