From 1ecdcb20745d4c287fe90c5aeb21a4859c6134e7 Mon Sep 17 00:00:00 2001 From: Adam Coldrick Date: Wed, 4 Nov 2015 15:48:29 +0000 Subject: [PATCH] Allow boolean preferences This patch fixes the checks in update_user_preferences so that boolean preferences are correctly updated and created. Previously, the preference having value == False would lead to nothing happening. Change-Id: Ibc8e1113759b16d45d7ba1f05a9c8d6c782314cd --- storyboard/db/api/users.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/storyboard/db/api/users.py b/storyboard/db/api/users.py index d9cac9b1..7960ae00 100644 --- a/storyboard/db/api/users.py +++ b/storyboard/db/api/users.py @@ -92,13 +92,13 @@ def user_update_preferences(user_id, preferences): continue # If the preference exists and has a new value. - if pref and value and pref.cast_value != value: + if pref and value is not None and pref.cast_value != value: pref.cast_value = value api_base.entity_update(models.UserPreference, pref.id, dict(pref)) continue # If the preference does not exist and a new value exists. - if not pref and value: + if not pref and value is not None: api_base.entity_create(models.UserPreference, { 'user_id': user_id, 'key': key,