Permalink
Browse files

catch conversion errors when updating settings

  • Loading branch information...
1 parent 12f532c commit ec3ef401cf81db8d56095a3673f609671e1c583b @rmartinjak rmartinjak committed Mar 22, 2013
Showing with 8 additions and 2 deletions.
  1. +8 −2 sagenb/notebook/conf.py
View
@@ -107,10 +107,16 @@ def update_from_form(self, form):
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()

0 comments on commit ec3ef40

Please sign in to comment.