Description
The error "'module' object has no attribute 'name'" is thrown after configuring auth = [ldap_login] in wikiconfig.py
Steps to reproduce
Add the following to wikiconfig.py
from MoinMoin.auth import ldap_login
- import ldap
- auth = [ldap_login]
Restart the Wiki and visit in web browser
Example
--> -->
AttributeError
'module' object has no attribute 'name'
If you want to report a bug, please save this page and attach it to your bug report.
Traceback
A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.
/home/osswww/wiki/packages/moin/lib/python2.5/site-packages/MoinMoin/request/request_standalone.py in __init__ (self=<MoinMoin.request.request_standalone.Request object at 0x2a97525ed0>, sa=<MoinMoin.server.server_standalone.MoinRequestHandler instance at 0x2a97524e18>, properties={})
- 58 ##self.debugEnvironment(sa.headers)
- 59
- 60 RequestBase.__init__(self, properties)
- 61
- 62 except Exception, err:
- global RequestBase = <class 'MoinMoin.request.RequestBase'>
- RequestBase.__init__ = <unbound method RequestBase.__init__>
- self = <MoinMoin.request.request_standalone.Request object at 0x2a97525ed0>
- properties = {}
/home/osswww/wiki/packages/moin/lib/python2.5/site-packages/MoinMoin/request/__init__.py in __init__ (self=<MoinMoin.request.request_standalone.Request object at 0x2a97525ed0>, properties={})
- 164 self.__dict__.update(properties)
- 165 try:
- 166 self._load_multi_cfg()
- 167 except error.NoConfigMatchedError:
- 168 self.makeForbidden(404, 'No wiki configuration matching the URL found!\r\n')
- self = <MoinMoin.request.request_standalone.Request object at 0x2a97525ed0>
- self._load_multi_cfg = <bound method Request._load_multi_cfg of <MoinMo...quest_standalone.Request object at 0x2a97525ed0>>
/home/osswww/wiki/packages/moin/lib/python2.5/site-packages/MoinMoin/request/__init__.py in _load_multi_cfg (self=<MoinMoin.request.request_standalone.Request object at 0x2a97525ed0>)
- 359 if not hasattr(self, 'cfg'):
- 360 self.clock.start('load_multi_cfg')
- 361 self.cfg = multiconfig.getConfig(self.url)
- 362 self.clock.stop('load_multi_cfg')
- 363
- self = <MoinMoin.request.request_standalone.Request object at 0x2a97525ed0>
- self.cfg undefined
- global multiconfig = <module 'MoinMoin.config.multiconfig' from '/hom...5/site-packages/MoinMoin/config/multiconfig.pyc'>
- multiconfig.getConfig = <function getConfig at 0x2a97519aa0>
- self.url = 'ossws-tst.corp.hp.com:8888/'
/home/osswww/wiki/packages/moin/lib/python2.5/site-packages/MoinMoin/config/multiconfig.py in getConfig (url='ossws-tst.corp.hp.com:8888/')
- 206 cfg = _config_cache[cfgName]
- 207 except KeyError:
- 208 cfg = _makeConfig(cfgName)
- 209 cfg = _config_cache.setdefault(cfgName, cfg)
- 210 return cfg
- cfg undefined
- global _makeConfig = <function _makeConfig at 0x2a97519230>
- cfgName = 'wikiconfig'
/home/osswww/wiki/packages/moin/lib/python2.5/site-packages/MoinMoin/config/multiconfig.py in _makeConfig (name='wikiconfig')
- 167 found_names = []
- 168 for auth in cfg.auth:
- 169 if not auth.name:
- 170 raise error.ConfigurationError("Auth methods must have a name.")
- 171 if auth.name in found_names:
- auth = <module 'MoinMoin.auth.ldap_login' from '/home/o...on2.5/site-packages/MoinMoin/auth/ldap_login.py'>
- auth.name undefined
AttributeError
'module' object has no attribute 'name'
- args = ("'module' object has no attribute 'name'",)
- message = "'module' object has no attribute 'name'"
System Details
- Date: Fri, 01 Aug 2008 13:33:59 +0000
- Platform: Linux g1t0248 2.6.5-7.244-smp #1 SMP Mon Dec 12 18:32:25 UTC 2005 x86_64
- Python: Python 2.5.2 (/home/osswww/wiki/packages/python/bin/python)
- MoinMoin: Release 1.7.1 (release)
Component selection
- authentication
Details
It appears that the attributes
- login_inputs
- logout_possible
- name
are defined within the class LDAPAuth and not at the module level and so are not visible when the following code in multiconfig.py is executed:
- {{{# postprocess configuration # 'setuid' special auth method auth method can log out cfg.auth_can_logout = ['setuid'] cfg.auth_login_inputs = [] found_names = [] for auth in cfg.auth:
- if not auth.name:
raise error.ConfigurationError("Auth methods must have a name.")
raise error.ConfigurationError("Auth method names must be unique.")
- cfg.auth_can_logout.append(auth.name)
- if not input in cfg.auth_login_inputs:
- cfg.auth_login_inputs.append(input)
cfg.auth_have_login = len(cfg.auth_login_inputs) > 0 return cfg
- if not auth.name:
}}}
Workaround
Discussion
Plan
- Priority:
- Assigned to:
- Status: wrong auth configuration, please see docs/CHANGES