Ticket #6183 (closed defect: fixed)

Opened 4 years ago

Last modified 1 year ago

LdapPlugin - Error with trac 0.12

Reported by: anonymous Assigned to: eblot
Priority: high Component: LdapPlugin
Severity: major Keywords: ldap, ldapplugin, 0.12
Cc: ilias@lazaridis.com 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

v070trac012.diff (1.7 kB) - added by lazaridis_com on 11/24/11 17:20:35.
Patch to create version 0.7.0 for trac 0.12

Change History

(follow-up: ↓ 2 ) 11/25/09 17:10:57 changed by tiagoaoa@cos.ufrj.br

A workaround is to change:

self._ldapcfg[name] = value

to

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

(in reply to: ↑ 1 ; follow-up: ↓ 3 ) 11/30/09 12:44:32 changed by 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!

(in reply to: ↑ 2 ) 12/05/09 00:16:16 changed by chris@digsby.com

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

Index: ldapplugin/api.py
===================================================================
--- ldapplugin/api.py	(revision 7222)
+++ ldapplugin/api.py	(working copy)
@@ -62,7 +62,7 @@
         self._ldapcfg = {}
         for name,value in self.config.options('ldap'):
             if name in LDAP_DIRECTORY_PARAMS:
-                self._ldapcfg[name] = value
+                self._ldapcfg[str(name)] = value
         # user entry local cache
         self._cache = {}
         # max time to live for a cache entry
@@ -178,7 +178,7 @@
         self._ldapcfg = {}
         for name,value in self.config.options('ldap'):
             if name in LDAP_DIRECTORY_PARAMS:
-                self._ldapcfg[name] = value
+                self._ldapcfg[str(name)] = value
         # user entry local cache
         self._cache = {}
         # max time to live for a cache entry

01/29/10 02:54:20 changed by anonymous

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

11/24/11 16:23:24 changed by ilias@lazaridis.com

  • cc set to ilias@lazaridis.com.

(follow-up: ↓ 7 ) 11/24/11 16:31:37 changed by ilias@lazaridis.com

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.

(in reply to: ↑ 6 ) 11/24/11 16:47:26 changed by eblot

Replying to ilias@lazaridis.com:

But would like to use the official repo.

Can you attach the patch file to this ticket?

11/24/11 17:20:35 changed by lazaridis_com

  • attachment v070trac012.diff added.

Patch to create version 0.7.0 for trac 0.12

(follow-up: ↓ 11 ) 11/24/11 19:09:51 changed by lazaridis_com

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

11/24/11 19:29:36 changed by eblot

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

11/24/11 19:31:40 changed by eblot

  • status changed from new to closed.
  • resolution set to fixed.

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

(in reply to: ↑ 8 ) 11/24/11 19:32:41 changed by eblot

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.

11/24/11 22:09:02 changed by lazaridis_com

Will keep "test the deliver" in mind.

updated doc:

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


Add/Change #6183 (LdapPlugin - Error with trac 0.12)




Change Properties
Action