SearchGroups blows up with an index out of range :
This happened to us all the time when clicking Groups tab in 'Users & Groups adminstration', and on certain group searches from sharing tab.
Platform Plone 2.5.3/Zope2.8.9.1/python2.3.5
PloneLDAP 1.0RC3 with bundled LDAPUserFolder 2.8 & LDAPMultiplugins 1.5
Module Products.PageTemplates.TALES, line 221, in evaluate
- URL: file:CMFPlone/skins/plone_forms/folder_localrole_form.pt
- Line 150, Column 20
- Expression: <PythonExpr group_search_submitted and gtool.searchForGroups( {request.get('group_search_param',''): request.get('group_search_term', '')}) or None> - Names:
{'container': <PloneSite at /uol>,
'context': <ATDocument at /uol/index_html>,
'default': <Products.PageTemplates.TALES.Default instance at 0xb71d324c>,
'here': <ATDocument at /uol/index_html>,
'loop': <Products.PageTemplates.TALES.SafeMapping object at 0xb446922c>,
'modules': <Products.PageTemplates.ZRPythonExpr._SecureModuleImporter instance at 0xb71f3e8c>,
'nothing': None,
'options': {'args': ()},
'repeat': <Products.PageTemplates.TALES.SafeMapping object at 0xb446922c>,
'request': <HTTPRequest, URL=https://swebdevnd51.cc.le.ac.uk/index_html/folder_localrole_form>,
'root': <Application at >,
'template': <FSPageTemplate at /uol/folder_localrole_form used for /uol/index_html>,
'traverse_subpath': [],
'user': <PloneUser 'nd51'>}
Module Products.PageTemplates.ZRPythonExpr, line 47, in __call__
- __traceback_info__: group_search_submitted and gtool.searchForGroups( {request.get('group_search_param',''): request.get('group_search_term', '')}) or None
Module Python expression "group_search_submitted and gtool.searchForGroups( {request.get('group_search_param',''): request.get('group_search_term', '')}) or None", line 1, in <expression>
Module Products.PlonePAS.tools.groups, line 267, in searchForGroups
Module Products.PluggableAuthService.PluggableAuthService, line 364, in searchGroups
Module Products.PloneLDAP.plugins.ldap, line 52, in enumerateGroups
Module Products.LDAPMultiPlugins.LDAPMultiPlugin, line 285, in enumerateGroups
Module Products.LDAPUserFolder.LDAPUserFolder, line 1093, in searchGroups
IndexError: list index out of range
line 1093 of LDAPUserFolder.py (from release 2.8) does this:
rec_dict[key] = val[0]
Unfortunately , sometimes val is empty. Some groups get returned by the previous line with a key 'Member' and an empty val. We are not interested in searching such groups anyway. This may be a bug somewhere else which I don't understand, but 1 line of defensive coding here will fix it.
Simply insert a : if val != []:
just before line 1093
(and obviously indent line 1093).
That's it! ;-)
This is a very important fix because with it, finally LDAP groups ACTUALLY WORK (for normal , non-superhuman Plone integrators) in Plone. ;-)
PloneLDAP 1.0RC3 works really well. A shame if it is let down by a bug in LDAPUserFolder (or a bug somewhere else that LDAPUserFolder doesn't gracefully handle)
|