Skip to content
This repository has been archived by the owner on Feb 26, 2022. It is now read-only.

Commit

Permalink
bug fix: need to make sure that numeric default values for prefs are …
Browse files Browse the repository at this point in the history
…integers
  • Loading branch information
erikvold committed Nov 19, 2011
1 parent 10da2c0 commit 299ec79
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion python-lib/cuddlefish/app-extension/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ function setDefaultPrefs() {
branch.setBoolPref(key, val);
break;
case "number":
branch.setIntPref(key, val);
if (value % 1 == 0) // number must be a integer, otherwise ignore it
branch.setIntPref(key, val);
break;
case "string":
branch.setCharPref(key, val);
Expand Down
4 changes: 3 additions & 1 deletion python-lib/cuddlefish/options_defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ def parse_options_defaults(options, jetpack_id):
value = pref["value"]
vtype = str(type(value))

if ("<type 'bool'>" == vtype):
if ("<type 'float'>" == vtype):
continue
elif ("<type 'bool'>" == vtype):
value = str(pref["value"]).lower()
elif ("<type 'str'>" == vtype):
value = "\"" + str(pref["value"]) + "\""
Expand Down

0 comments on commit 299ec79

Please sign in to comment.