Changeset - a45113998d07
[Not reviewed]
default
0 1 0
Søren Løvborg - 10 years ago 2015-07-14 13:59:59
kwi@kwi.dk
AuthSettingsController: assume 'auth_plugins' option exists

In formglobals, the provided 'auth_plugins' default value is always
replaced with the real database value, returned along with other
plugin settings by Setting.get_auth_settings.

We can safely assume that the database value exists, since not only does
db_manage initialize the 'auth_plugins' option upon database creation,
but other authentication modules already assume its existence.

For instance, Settings.get_auth_plugins() is equivalent to

Settings.get_auth_settings()['auth_plugins']

except that get_auth_plugins will throw AttributeError, not KeyError,
if the 'auth_plugins' key does not exist in the database.
1 file changed with 1 insertions and 4 deletions:
0 comments (0 inline, 0 general)
kallithea/controllers/admin/auth_settings.py
Show inline comments
 
@@ -64,10 +64,7 @@ class AuthSettingsController(BaseControl
 
    def index(self, defaults=None, errors=None, prefix_error=False):
 
        self.__load_defaults()
 
        _defaults = {}
 
        # default plugins loaded
 
        formglobals = {
 
            "auth_plugins": ["kallithea.lib.auth_modules.auth_internal"]
 
        }
 
        formglobals = {}
 
        formglobals.update(Setting.get_auth_settings())
 
        formglobals["plugin_settings"] = {}
 
        formglobals["auth_plugins_shortnames"] = {}
0 comments (0 inline, 0 general)