Changeset - 7b780f5f5cab
[Not reviewed]
default
0 1 0
Søren Løvborg - 10 years ago 2015-08-24 16:50:43
sorenl@unity3d.com
auth: avoid random auth_internal failures - add explicit import of auth_internal to user admin

auth_internal would often have been loaded by the custom auth module loader and
available as auth_modules.auth_internal ... but sometimes it wasn't and
navigating to Add User would fail with:

File '.../kallithea/controllers/admin/users.py', line 155 in new
c.default_extern_type = auth_modules.auth_internal.KallitheaAuthPlugin.name
AttributeError: 'module' object has no attribute 'auth_internal'
1 file changed with 5 insertions and 4 deletions:
0 comments (0 inline, 0 general)
kallithea/controllers/admin/users.py
Show inline comments
 
@@ -43,6 +43,7 @@ from kallithea.lib import helpers as h
 
from kallithea.lib.auth import LoginRequired, HasPermissionAllDecorator, \
 
    AuthUser
 
from kallithea.lib import auth_modules
 
from kallithea.lib.auth_modules import auth_internal
 
from kallithea.lib.base import BaseController, render
 
from kallithea.model.api_key import ApiKeyModel
 

	
 
@@ -120,8 +121,8 @@ class UsersController(BaseController):
 
    def create(self):
 
        """POST /users: Create a new item"""
 
        # url('users')
 
        c.default_extern_type = auth_modules.auth_internal.KallitheaAuthPlugin.name
 
        c.default_extern_name = auth_modules.auth_internal.KallitheaAuthPlugin.name
 
        c.default_extern_type = auth_internal.KallitheaAuthPlugin.name
 
        c.default_extern_name = auth_internal.KallitheaAuthPlugin.name
 
        user_model = UserModel()
 
        user_form = UserForm()()
 
        try:
 
@@ -152,8 +153,8 @@ class UsersController(BaseController):
 
    def new(self, format='html'):
 
        """GET /users/new: Form to create a new item"""
 
        # url('new_user')
 
        c.default_extern_type = auth_modules.auth_internal.KallitheaAuthPlugin.name
 
        c.default_extern_name = auth_modules.auth_internal.KallitheaAuthPlugin.name
 
        c.default_extern_type = auth_internal.KallitheaAuthPlugin.name
 
        c.default_extern_name = auth_internal.KallitheaAuthPlugin.name
 
        return render('admin/users/user_add.html')
 

	
 
    def update(self, id):
0 comments (0 inline, 0 general)