Skip to content

Commit 9e788c8

Browse files
Merge pull request #63 from yobnoj/master
Capitalization of entity-type json key for PortfolioItem get requests
2 parents 14ec865 + 234650e commit 9e788c8

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
@@ -108,9 +108,10 @@ def __getattr__(self, name):
108108
raise Exception('Unsupported attempt to retrieve context attribute')
109109

110110
rallyEntityTypeName = self.__class__.__name__
111-
entity_path, oid = self._ref.split(SLM_WS_VER)[-1].rsplit('/', 1)
112-
if entity_path.startswith('portfolioitem/'):
113-
rallyEntityTypeName = entity_path.split('/')[-1].capitalize()
111+
PORTFOLIO_PREFIX = 'PortfolioItem_'
112+
if rallyEntityTypeName.startswith(PORTFOLIO_PREFIX):
113+
rallyEntityTypeName = re.sub(PORTFOLIO_PREFIX, '',
114+
rallyEntityTypeName)
114115

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

0 commit comments

Comments
 (0)