diff --git a/tailbone/views/settings.py b/tailbone/views/settings.py index c82351fc..65a8066b 100644 --- a/tailbone/views/settings.py +++ b/tailbone/views/settings.py @@ -140,6 +140,10 @@ class AppSettingsView(View): 'name': setting.node_name, 'default': self.get_setting_value(setting), } + if kwargs['default'] is None: + kwargs['default'] = colander.null + if not setting.required: + kwargs['missing'] = colander.null if setting.choices: kwargs['validator'] = colander.OneOf(setting.choices) kwargs['widget'] = forms.widgets.JQuerySelectWidget( @@ -151,11 +155,15 @@ class AppSettingsView(View): def get_node_type(self, setting): if setting.data_type is bool: return colander.Bool() + elif setting.data_type is int: + return colander.Integer() return colander.String() def save_form(self, form): for setting in self.iter_known_settings(): value = form.validated[setting.node_name] + if value is colander.null: + value = None self.save_setting_value(setting, value) def iter_known_settings(self):