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

Fix geizhals crash if no price found #19197

Merged
merged 4 commits into from Dec 12, 2018

Conversation

Projects
None yet
4 participants
@tinloaf
Copy link
Contributor

tinloaf commented Dec 11, 2018

Description:

Currently, if the geizhals package can't find a price for a product (because the Geizhals website can't find a price…), that produces a crash, as an empty list is returned. This change fixes that.

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
@@ -80,7 +80,10 @@ def icon(self):
@property
def state(self):
"""Return the best price of the selected product."""
return self._device.prices[0]
if not self._device.prices:
return STATE_UNKNOWN

This comment has been minimized.

@fabaff

fabaff Dec 12, 2018

Member

Return None.

This comment has been minimized.

@tinloaf

tinloaf Dec 12, 2018

Contributor

Sure, changed it. What is STATE_UNKNOWN for?

This comment has been minimized.

@fabaff

fabaff Dec 12, 2018

Member

As far as I remember was it use to display the string unknown in the frontend but now the frontend can handle it directly.

tinloaf added some commits Dec 12, 2018

@fabaff

fabaff approved these changes Dec 12, 2018

Copy link
Member

fabaff left a comment

Thanks 🐦

@fabaff fabaff merged commit 4984030 into home-assistant:dev Dec 12, 2018

5 checks passed

Hound No violations found. Woof!
WIP ready for review
Details
cla-bot Everyone involved has signed the CLA
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls First build on fix_geizhals_empty_list at 92.877%
Details

@wafflebot wafflebot bot removed the in progress label Dec 12, 2018

@balloob balloob referenced this pull request Jan 10, 2019

Merged

0.85.0 #19897

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment