From 9dda977ece01b26003fe10078586797301065bc7 Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Sat, 16 Mar 2013 20:38:32 -0400 Subject: [PATCH] Handle days_early_for_beta possibly being a string --- lms/xmodule_namespace.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lms/xmodule_namespace.py b/lms/xmodule_namespace.py index a641947a0e..4c04700a31 100644 --- a/lms/xmodule_namespace.py +++ b/lms/xmodule_namespace.py @@ -8,6 +8,13 @@ class StringyBoolean(Boolean): return value.lower() == 'true' return value +class StringyFloat(Float): + def from_json(self, value): + try: + return float(value) + except: + return None + class LmsNamespace(Namespace): hide_from_toc = StringyBoolean( @@ -34,5 +41,5 @@ class LmsNamespace(Namespace): graceperiod = Timedelta(help="Amount of time after the due date that submissions will be accepted", scope=Scope.settings) showanswer = String(help="When to show the problem answer to the student", scope=Scope.settings, default="closed") rerandomize = String(help="When to rerandomize the problem", default="always", scope=Scope.settings) - days_early_for_beta = Float(help="Number of days early to show content to beta users", default=None, scope=Scope.settings) + days_early_for_beta = StringyFloat(help="Number of days early to show content to beta users", default=None, scope=Scope.settings)