Skip to content

Commit

Permalink
explicitly check for None
Browse files Browse the repository at this point in the history
  • Loading branch information
wangjoshuah committed Jan 18, 2018
1 parent c19c18e commit ef0c0ee
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions optimizely/optimizely.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,15 +198,15 @@ def _get_feature_variable_for_type(self, feature_key, variable_key, variable_typ
- Variable key is invalid.
- Mismatch with type of variable.
"""
if not feature_key:
if feature_key is None:
self.logger.log(enums.LogLevels.ERROR, enums.Errors.NONE_FEATURE_KEY_PARAMETER)
return None

if not variable_key:
if variable_key is None:
self.logger.log(enums.LogLevels.ERROR, enums.Errors.NONE_VARIABLE_KEY_PARAMETER)
return None

if not user_id:
if user_id is None:
self.logger.log(enums.LogLevels.ERROR, enums.Errors.NONE_USER_ID_PARAMETER)
return None

Expand Down Expand Up @@ -386,11 +386,11 @@ def is_feature_enabled(self, feature_key, user_id, attributes=None):
self.logger.log(enums.LogLevels.ERROR, enums.Errors.INVALID_DATAFILE.format('is_feature_enabled'))
return False

if not feature_key:
if feature_key is None:
self.logger.log(enums.LogLevels.ERROR, enums.Errors.NONE_FEATURE_KEY_PARAMETER)
return False

if not user_id:
if user_id is None:
self.logger.log(enums.LogLevels.ERROR, enums.Errors.NONE_USER_ID_PARAMETER)
return False

Expand Down

0 comments on commit ef0c0ee

Please sign in to comment.