Skip to content

Commit

Permalink
PDF functionality optional #124
Browse files Browse the repository at this point in the history
  • Loading branch information
jesper-raemaekers committed Aug 16, 2023
1 parent 21b43bf commit 705337f
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion polarion/polarion.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,23 @@ def _getTypes(self):
self.CustomType = self.getTypeFromService('Tracker', 'ns2:Custom')
self.ArrayOfEnumOptionIdType = self.getTypeFromService('Tracker', 'ns2:ArrayOfEnumOptionId')
self.ArrayOfSubterraURIType = self.getTypeFromService('Tracker', 'ns1:ArrayOfSubterraURI')
self.PdfProperties = self.getTypeFromService('Tracker', 'ns2:PdfProperties')
self._PdfProperties = None
try:
self._PdfProperties = self.getTypeFromService('Tracker', 'ns2:PdfProperties')
except:
# fail silently if current polarion version does not have PDF properties
pass

@property
def PdfProperties(self):
"""
Get PDF properties object but only is it exist.
If is was not able to get it from Polarion, fail with a exception only when using this feature
@return: PdfProperties
"""
if self._PdfProperties is None:
raise Exception(f'PDF not supported in this Polarion version')
return self._PdfProperties

def _getTransport(self):
"""
Expand Down

0 comments on commit 705337f

Please sign in to comment.