jonni83 / smartgarage

1 stars 1 forks source link

No input validation in turn_on_only #4

Closed riverajo closed 10 years ago

riverajo commented 10 years ago

There is no input validation in Relay class turn_on_only method. I would imagine that this is dangerous as the input is an int corresponding to a pin on the GPIO board. This could leave you open to accidentally setting any pin to GPIO.LOW.

riverajo commented 10 years ago

I looked at the change and the input is checked if it's in a list of valid colors, but then you simply return. I would suggest that you raise an exception to indicate to a user of this method that something wrong happened. I suggest ValueError https://docs.python.org/2/library/exceptions.html#exceptions.ValueError