[sagenb] 68/179: catch conversion errors when updating settings

felix salfelder felix-guest at moszumanska.debian.org
Tue May 6 12:05:10 UTC 2014


This is an automated email from the git hooks/post-receive script.

felix-guest pushed a commit to branch master
in repository sagenb.

commit ec3ef401cf81db8d56095a3673f609671e1c583b
Author: Robin Martinjak <rob at rmartinjak.de>
Date:   Fri Mar 22 16:43:28 2013 +0100

    catch conversion errors when updating settings
---
 sagenb/notebook/conf.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/sagenb/notebook/conf.py b/sagenb/notebook/conf.py
index e435d6d..e573e55 100644
--- a/sagenb/notebook/conf.py
+++ b/sagenb/notebook/conf.py
@@ -107,10 +107,16 @@ class Configuration(object):
                     val = False
 
             elif typ == T_INTEGER:
-                val = int(val)
+                try:
+                    val = int(val)
+                except ValueError:
+                    val = self[key]
 
             elif typ == T_REAL:
-                val = float(val)
+                try:
+                    val = float(val)
+                except ValueError:
+                    val = self[key]
 
             elif typ == T_LIST:
                 val = val.strip()

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/sagenb.git



More information about the debian-science-commits mailing list