diff --git a/jira/client.py b/jira/client.py index 049483fe6..c65f62c4e 100644 --- a/jira/client.py +++ b/jira/client.py @@ -1974,11 +1974,10 @@ def create_issue_link(self, type, inwardIssue, outwardIssue, comment=None): :rtype: Response """ # let's see if we have the right issue link 'type' and fix it if needed - if not hasattr(self, '_cached_issuetypes'): - self._cached_issue_link_types = self.issue_link_types() + issue_link_types = self.issue_link_types() - if type not in self._cached_issue_link_types: - for lt in self._cached_issue_link_types: + if type not in issue_link_types: + for lt in issue_link_types: if lt.outward == type: # we are smart to figure it out what he meant type = lt.name @@ -2018,15 +2017,18 @@ def issue_link(self, id): # Issue link types - def issue_link_types(self): + def issue_link_types(self, force=False): """Get a list of issue link type Resources from the server. :rtype: List[IssueLinkType] """ - r_json = self._get_json('issueLinkType') - link_types = [IssueLinkType(self._options, self._session, raw_link_json) for raw_link_json in - r_json['issueLinkTypes']] - return link_types + if not hasattr(self, 'self._cached_issue_link_types') or force: + r_json = self._get_json('issueLinkType') + self._cached_issue_link_types = [ + IssueLinkType(self._options, self._session, raw_link_json) + for raw_link_json in r_json['issueLinkTypes'] + ] + return self._cached_issue_link_types def issue_link_type(self, id): """Get an issue link type Resource from the server.