Edgewall Software
Modify

Opened 8 years ago

Closed 8 years ago

Last modified 8 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:

Description

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/50.14.22.465 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
    dispatcher.dispatch(req)
  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
    req.perm(versioned_page.resource).require('WIKI_VIEW')
  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
    perm)
  File "build/bdist.linux-x86_64/egg/trac/perm.py", line 294, in check_permission
    get_user_permissions(username)
  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
    self._open()
  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, 8 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
    3031
    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))
    654656
    655657    def _search(self, basedn, filterstr='(objectclass=*)', attributes=None,
    656658                scope=ldap.SCOPE_ONELEVEL):

comment:2 by Jun Omae, 8 years ago

Resolution: cantfix
Status: newclosed

comment:3 by questioner, 8 years ago

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

comment:4 by questioner, 8 years ago

Fixed, thanks for help.

comment:5 by Ryan J Ollos, 8 years ago

Applied the patch in [th 15677].

Modify Ticket

Change Properties
Set your email in Preferences
Action
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.