Modify

Opened 15 years ago

Closed 13 years ago

Last modified 11 years ago

#6183 closed defect (fixed)

LdapPlugin - Error with trac 0.12

Reported by: anonymous Owned by: Emmanuel Blot
Priority: high Component: LdapPlugin
Severity: major Keywords: ldap, ldapplugin, 0.12
Cc: ilias@… Trac Release: 0.12

Description

Might stem from the python version, and doc on the web seems to point towards incompatibilities with unicode strings. I'm using the trunk "Trac-0.12dev_r0-py2.6.egg" with the latest Ldapplugin built for 0.11 with python 2.6 on Ubuntu 9.10,

Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/Trac-0.12dev_r0-py2.6.egg/trac/web/api.py", line 393, in send_error
    'text/html')
  File "/usr/local/lib/python2.6/dist-packages/Trac-0.12dev_r0-py2.6.egg/trac/web/chrome.py", line 758, in render_template
    data = self.populate_data(req, data)
  File "/usr/local/lib/python2.6/dist-packages/Trac-0.12dev_r0-py2.6.egg/trac/web/chrome.py", line 649, in populate_data
    d['chrome'].update(req.chrome)
  File "/usr/local/lib/python2.6/dist-packages/Trac-0.12dev_r0-py2.6.egg/trac/web/api.py", line 209, in __getattr__
    value = self.callbacks[name](self)
  File "/usr/local/lib/python2.6/dist-packages/Trac-0.12dev_r0-py2.6.egg/trac/web/chrome.py", line 499, in prepare_request
    contributor.get_navigation_items(req):
  File "/usr/local/lib/python2.6/dist-packages/Trac-0.12dev_r0-py2.6.egg/trac/ticket/web_ui.py", line 168, in get_navigation_items
    if 'TICKET_CREATE' in req.perm:
  File "/usr/local/lib/python2.6/dist-packages/Trac-0.12dev_r0-py2.6.egg/trac/perm.py", line 527, in has_permission
    return self._has_permission(action, resource)
  File "/usr/local/lib/python2.6/dist-packages/Trac-0.12dev_r0-py2.6.egg/trac/perm.py", line 541, in _has_permission
    check_permission(action, perm.username, resource, perm)
  File "/usr/local/lib/python2.6/dist-packages/Trac-0.12dev_r0-py2.6.egg/trac/perm.py", line 428, in check_permission
    perm)
  File "/usr/local/lib/python2.6/dist-packages/Trac-0.12dev_r0-py2.6.egg/trac/perm.py", line 285, in check_permission
    get_user_permissions(username)
  File "/usr/local/lib/python2.6/dist-packages/Trac-0.12dev_r0-py2.6.egg/trac/perm.py", line 360, in get_user_permissions
    for perm in self.store.get_user_permissions(username):
  File "/usr/local/lib/python2.6/dist-packages/Trac-0.12dev_r0-py2.6.egg/trac/perm.py", line 175, in get_user_permissions
    subjects.update(provider.get_permission_groups(username))
  File "build/bdist.linux-x86_64/egg/ldapplugin/api.py", line 106, in get_permission_groups
    self._ldap = LdapConnection(self.env.log, bind, **self._ldapcfg)
TypeError: __init__() keywords must be strings

Attachments (1)

v070trac012.diff (1.7 KB) - added by lazaridis_com 13 years ago.
Patch to create version 0.7.0 for trac 0.12

Download all attachments as: .zip

Change History (14)

comment:1 Changed 15 years ago by tiagoaoa@…

A workaround is to change:

self._ldapcfg[name] = value

to

self._ldapcfg[str(name)] = str(value)

comment:2 in reply to:  1 ; Changed 15 years ago by heiv@…

Replying to tiagoaoa@cos.ufrj.br:

A workaround is to change:

self._ldapcfg[name] = value

to

self._ldapcfg[str(name)] = str(value)

Thx for this change in the source code ! It works fine with me for the trac v0.11.6!

comment:3 in reply to:  2 Changed 15 years ago by chris@…

Replying to heiv@reseau-js.com:

Replying to tiagoaoa@cos.ufrj.br:

A workaround is to change:

self._ldapcfg[name] = value

to

self._ldapcfg[str(name)] = str(value)

Thx for this change in the source code ! It works fine with me for the trac v0.11.6!

This works for me as well on v0.11.6

I came looking to make a ticket with that fix, found one already existed.

Note: There are two places where this change should be made: once in LdapPermissionGroupProvider and again in LdapPermissionStore

  • ldapplugin/api.py

     
    6262        self._ldapcfg = {}
    6363        for name,value in self.config.options('ldap'):
    6464            if name in LDAP_DIRECTORY_PARAMS:
    65                 self._ldapcfg[name] = value
     65                self._ldapcfg[str(name)] = value
    6666        # user entry local cache
    6767        self._cache = {}
    6868        # max time to live for a cache entry
     
    178178        self._ldapcfg = {}
    179179        for name,value in self.config.options('ldap'):
    180180            if name in LDAP_DIRECTORY_PARAMS:
    181                 self._ldapcfg[name] = value
     181                self._ldapcfg[str(name)] = value
    182182        # user entry local cache
    183183        self._cache = {}
    184184        # max time to live for a cache entry

comment:4 Changed 15 years ago by anonymous

Trac 0.11.6 also has the same problem. But LdapPlugin works fine after I modified api.py based on above code.

comment:5 Changed 13 years ago by ilias@…

Cc: ilias@… added; anonymous removed

comment:6 Changed 13 years ago by ilias@…

Can someone with commit-rights please update the repository with a 0.7.0 version fro trac 0.12, which contains the above patches?

I've made a temporary 0.7.0 version here:

https://github.com/lazaridis-com/ldaptrac/tree/master/0.12

But would like to use the official repo.

comment:7 in reply to:  6 Changed 13 years ago by Emmanuel Blot

Replying to ilias@lazaridis.com:

But would like to use the official repo.

Can you attach the patch file to this ticket?

Changed 13 years ago by lazaridis_com

Attachment: v070trac012.diff added

Patch to create version 0.7.0 for trac 0.12

comment:8 Changed 13 years ago by lazaridis_com

(please let me know if I can do anything else on my side)

comment:9 Changed 13 years ago by Emmanuel Blot

(In [10933]) Refs #6183. Duplicate plugin for Trac 0.12

comment:10 Changed 13 years ago by Emmanuel Blot

Resolution: fixed
Status: newclosed

(In [10934]) Closes #6183. Apply patch and update AUTHORS file

comment:11 in reply to:  8 Changed 13 years ago by Emmanuel Blot

Replying to lazaridis_com:

(please let me know if I can do anything else on my side)

If you can test the delivery, it would be nice as I have no spare time for now. Thanks.

comment:12 Changed 13 years ago by lazaridis_com

Will keep "test the deliver" in mind.

updated doc:

https://trac-hacks.org/wiki/LdapPlugin?action=diff&version=54

comment:13 Changed 11 years ago by Pierre-André Delaroche

Thanks, seems to be working on trac v0.11.6 also, with the French language package.

Regards,

Pierre-André, Genève

création de site

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Emmanuel Blot.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.