Skip to content

Commit 234650e

Browse files
author
Jonathan Walton
committed
Capitalization of Key
When requesting portfolio items, the key used in the rest response is odd. The existing code to munge it was not preserving necessary capitalization, and so get requests using entity-types of PortfolioItem/MarketRequirement, PortfolioItem/ProductRequirement, and PortfolioItem/ReleaseRequirement were failing.
1 parent ed49086 commit 234650e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pyral/entity.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,10 @@ def __getattr__(self, name):
102102
raise Exception('Unsupported attempt to retrieve context attribute')
103103

104104
rallyEntityTypeName = self.__class__.__name__
105-
entity_path, oid = self._ref.split(SLM_WS_VER)[-1].rsplit('/', 1)
106-
if entity_path.startswith('portfolioitem/'):
107-
rallyEntityTypeName = entity_path.split('/')[-1].capitalize()
105+
PORTFOLIO_PREFIX = 'PortfolioItem_'
106+
if rallyEntityTypeName.startswith(PORTFOLIO_PREFIX):
107+
rallyEntityTypeName = re.sub(PORTFOLIO_PREFIX, '',
108+
rallyEntityTypeName)
108109

109110
faultTrigger = "getattr fault detected on %s instance for attribute: %s (hydrated? %s)" % \
110111
(rallyEntityTypeName, name, self._hydrated)

0 commit comments

Comments
 (0)