Edgewall Software

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#12546 closed defect (cantfix)

TypeError: 'int' object has no attribute '__getitem__'

Reported by: denns.liou@… Owned by:
Priority: normal Milestone:
Component: general Version: 1.0.2
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:


How to Reproduce

While doing a GET operation on /, Trac issued an internal error.

(please provide additional details here)

Request parameters:


User agent: Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Dragon/ Chrome/50.0.2661.102 Safari/537.36

System Information

System information not available

Enabled Plugins

Plugin information not available

Python Traceback

Traceback (most recent call last):
  File "build/bdist.linux-x86_64/egg/trac/web/main.py", line 512, in _dispatch_request
  File "build/bdist.linux-x86_64/egg/trac/web/main.py", line 221, in dispatch
    resp = chosen_handler.process_request(req)
  File "build/bdist.linux-x86_64/egg/trac/wiki/web_ui.py", line 134, in process_request
  File "build/bdist.linux-x86_64/egg/trac/perm.py", line 577, in require
    if not self._has_permission(action, resource):
  File "build/bdist.linux-x86_64/egg/trac/perm.py", line 568, in _has_permission
    check_permission(action, perm.username, resource, perm)
  File "build/bdist.linux-x86_64/egg/trac/perm.py", line 460, in check_permission
  File "build/bdist.linux-x86_64/egg/trac/perm.py", line 294, in check_permission
  File "build/bdist.linux-x86_64/egg/trac/perm.py", line 396, in get_user_permissions
    for perm in self.store.get_user_permissions(username) or []:
  File "build/bdist.linux-x86_64/egg/ldapplugin/api.py", line 206, in get_user_permissions
    users += list(provider.get_permission_groups(username))
  File "build/bdist.linux-x86_64/egg/ldapplugin/api.py", line 109, in get_permission_groups
    ldapgroups = self._get_user_groups(username)
  File "build/bdist.linux-x86_64/egg/ldapplugin/api.py", line 150, in _get_user_groups
    ldap_groups = self._ldap.get_groups()
  File "build/bdist.linux-x86_64/egg/ldapplugin/api.py", line 554, in get_groups
    groups = self.get_dn(self.basedn, 'objectclass=' + self.groupname)
  File "build/bdist.linux-x86_64/egg/ldapplugin/api.py", line 577, in get_dn
    sr = self._search(basedn, filterstr, ['dn'], ldap.SCOPE_SUBTREE)
  File "build/bdist.linux-x86_64/egg/ldapplugin/api.py", line 660, in _search
  File "build/bdist.linux-x86_64/egg/ldapplugin/api.py", line 653, in _open
    raise TracError("Unable to open LDAP cnx: %s" % e[0]['desc'])
TypeError: 'int' object has no attribute '__getitem__'

Attachments (0)

Change History (5)

comment:1 by Jun Omae, 5 years ago

PluginIssue (th:LdapPlugin). Please report to the plugin maintainers via trac-hacks.org.

Anyway, it seems the error is raised while formatting error message about LDAP. Try the following patch. Also, I guess incorrect configurations lead the original error.

  • ldapplugin/0.12/ldapplugin/api.py

    diff --git a/ldapplugin/0.12/ldapplugin/api.py b/ldapplugin/0.12/ldapplugin/api.py
    index 2736437..59bc953 100644
    a b import ldap  
    2727from trac.core import *
    2828from trac.perm import IPermissionGroupProvider, IPermissionStore
    2929from trac.config import _TRUE_VALUES
     30from trac.util.text import exception_to_unicode
    3132LDAP_MODULE_CONFIG = [ 'enable', 'permfilter',
    3233                       'global_perms', 'manage_groups'
    class LdapConnection(object):  
    648649        except ldap.LDAPError, e:
    649650            self._ds = None
    650651            if self.bind_user:
    651                 self.log.warn("Unable to open LDAP with user %s" % \
    652                               self.bind_user)
    653             raise TracError("Unable to open LDAP cnx: %s" % e[0]['desc'])
     652                self.log.warning("Unable to open LDAP with user %s",
     653                                 self.bind_user)
     654            raise TracError("Unable to open LDAP cnx: %s" %
     655                            exception_to_unicode(e))
    655657    def _search(self, basedn, filterstr='(objectclass=*)', attributes=None,
    656658                scope=ldap.SCOPE_ONELEVEL):

comment:2 by Jun Omae, 5 years ago

Resolution: cantfix
Status: newclosed

comment:3 by questioner, 5 years ago

Thanks fo answer, But how can I find "ldapplugin/0.12/ldapplugin/api.py" and edit?

comment:4 by questioner, 5 years ago

Fixed, thanks for help.

comment:5 by Ryan J Ollos, 5 years ago

Applied the patch in [th 15677].

Modify Ticket

Change Properties
Set your email in Preferences
as closed The ticket will remain with no owner.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from (none) to the specified user.

Add Comment

E-mail address and name can be saved in the Preferences .
Note: See TracTickets for help on using tickets.