From b5079c9ba9568612faba9db3722d0cdd6a67722d Mon Sep 17 00:00:00 2001 From: Johannes Bornhold Date: Mon, 20 Jun 2016 17:27:04 +0200 Subject: [PATCH] authn: Fix priority of default values if some values are missing during POST Normally this affects only the test suite but doesn't hurt to be correct :) --- rhodecode/authentication/views.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rhodecode/authentication/views.py b/rhodecode/authentication/views.py index 192d26be..af1e35cb 100644 --- a/rhodecode/authentication/views.py +++ b/rhodecode/authentication/views.py @@ -56,10 +56,13 @@ class AuthnPluginViewBase(object): errors = errors or {} schema = self.plugin.get_settings_schema() - # Get default values for the form. + # Compute default values for the form. Priority is: + # 1. Passed to this method 2. DB value 3. Schema default for node in schema: - db_value = self.plugin.get_setting_by_name(node.name) + db_value = self.plugin.get_setting_by_name( + node.name, colander.null) defaults.setdefault(node.name, db_value) + defaults = schema.serialize(defaults) template_context = { 'defaults': defaults,