# HG changeset patch # User Martin Bornhold # Date 2016-06-28 14:28:18 # Node ID 3526ca25c00d6e764a0230b20750341cb392d4f8 # Parent 5b75602eaf53ee7552296f6acd703d00ecebb36e authn: Generate the form default values manually. When using colander.flatten(data) it adds colander.null for each missing form field. But this is not correct. What we want here is a dict wich contains only the keys/values from request.params that match a form field. diff --git a/rhodecode/authentication/views.py b/rhodecode/authentication/views.py --- a/rhodecode/authentication/views.py +++ b/rhodecode/authentication/views.py @@ -80,15 +80,17 @@ class AuthnPluginViewBase(object): View that validates and stores the plugin settings. """ schema = self.plugin.get_settings_schema() + data = self.request.params + try: - valid_data = schema.deserialize(self.request.params) + valid_data = schema.deserialize(data) except colander.Invalid, e: # Display error message and display form again. self.request.session.flash( _('Errors exist when saving plugin settings. ' 'Please check the form inputs.'), queue='error') - defaults = schema.flatten(self.request.params) + defaults = {key: data[key] for key in data if key in schema} return self.settings_get(errors=e.asdict(), defaults=defaults) # Store validated data.