Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use flag instead of getattr as it was not working as expected. Provid… #14

Merged
merged 2 commits into from
Apr 1, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 6 additions & 3 deletions haralyzer/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,16 +195,19 @@ def __init__(self, page_id, har_parser=None, har_data=None):

# Init properties that mimic the actual 'pages' object from the HAR file
raw_data = self.parser.har_data
valid = False
for page in raw_data['pages']:
if page['id'] == self.page_id:
valid = True
self.title = page['title']
self.startedDateTime = page['startedDateTime']
self.pageTimings = page['pageTimings']

if not getattr(self, 'title', None):
if not valid:
page_ids = [page['id'] for page in raw_data['pages']]
raise PageNotFoundError(
'No page found with id {0}\n\nValid pages are {1}'.format(
self.page_id, self.parser.pages)
'No page found with id {0}\n\nPage ID\'s are {1}'.format(
self.page_id, page_ids)
)

def __repr__(self):
Expand Down