jesper-raemaekers / python-polarion

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

export PDF need repeat Table header parameter #152

Closed TristanFAURE closed 10 months ago

TristanFAURE commented 1 year ago

Hello on Polarion version 2304 the export PDF function raises the error : File "/Users/tristan.faure/Library/Python/3.9/lib/python/site-packages/zeep/xsd/elements/element.py", line 226, in render self.validate(value, render_path) File "/Users/tristan.faure/Library/Python/3.9/lib/python/site-packages/zeep/xsd/elements/element.py", line 284, in validate raise exceptions.ValidationError( zeep.exceptions.ValidationError: Missing element repeatTableHeaders (exportDocumentToPDF.exportPdfProperties.repeatTableHeaders)

The error is fixed if i change in document.py

def exportDocumentToPDF(self):
        """
        Download a PDF export of the document.
        :return: bytes
        """
        service = self._polarion.getService('Tracker')
        pdf_props_obj = self._polarion.PdfProperties('A4', 'Portrait', True, True, True)

to (change in call of PdfProperties)

def exportDocumentToPDF(self):
        """
        Download a PDF export of the document.
        :return: bytes
        """
        service = self._polarion.getService('Tracker')
        pdf_props_obj = self._polarion.PdfProperties('A4', 'Portrait', True, True, True, True)
        serialized_pdf_props = serialize_object(pdf_props_obj)
        pdf = service.exportDocumentToPDF(self._uri, serialized_pdf_props)
        return pdf

Did somebody have the same issue ?

jesper-raemaekers commented 11 months ago

I do not have 2304, but maybe there is a way to detect the amount of required properties and just add one if needed.

TristanFAURE commented 11 months ago

I'm not really an expert about SOAP API capabilities, a work around I found is doing a GET on the index and grep on the buildid for instance : buildId=20230416-1128-2304-b065e427 That could be a way to provide a function that returns the version of the instance ... ? edit: we can also catch the exception and retry with the other call if it happens

TristanFAURE commented 11 months ago

I did not realized a pull request identified this issue : https://github.com/jesper-raemaekers/python-polarion/pull/125

github-actions[bot] commented 10 months ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 10 months ago

This issue was closed because it has been inactive for 14 days since being marked as stale.