alexcouper/pyrally — Issue #3: Defunct owners of stories cause an odd exception
Author: OddBloke
Created: 2011-12-19 15:17:18+00:00
State: open

from pyrally.client import RallyAPIClient
from pyrally import settings

rac = RallyAPIClient(settings.RALLY_USERNAME, settings.RALLY_PASSWORD)

story = rac.get_story_by_name('us524')
print story.Owner.DisplayName
story = rac.get_story_by_name('us124')
print story.Owner.DisplayName```

produces

Phil O
Traceback (most recent call last):
File "testcase.py", line 10, in
print story.Owner.DisplayName
File "/home/daniel/dev/pyrally/pyrally/models.py", line 62, in __getattribute__
return object_class.create_from_ref(rally_item['_ref'])
File "/home/daniel/dev/pyrally/pyrally/models.py", line 82, in create_from_ref
return cls(response)
File "/home/daniel/dev/pyrally/pyrally/models.py", line 50, in __init__
self.rally_data = data_dict[self.rally_name]
KeyError: 'User'