[melbourne-pug] custom library version problems
Geoff Crompton
geoffc at trinity.unimelb.edu.au
Fri Feb 22 04:22:24 CET 2008
I've recently started a new job, and I'm trying to maintain some python
code (having never done any python programming).
So they have a library called tcldap.py. It works fine on an Debian
Sarge box with python 2.3.5, python-ldap 2.0.4 and libldap2 2.1.30 but
on a Debian Etch box with python 2.4.4, python-ldap 2.2.0 and libldap2
2.1.30 I get an AttributeError exception thrown.
The class inherits from ldap.ldapobject.SimpleLDAPObject, and wraps the
result() method. It seems it grabs the data somehow, and uses KIDict
(which is in the tcldap.py file higher up) to give case insensitive keys.
The exception is raised when I call self._ldap_call(self._l.result2...
It seems in this version of python-ldap there is no self._l.result2. But
I don't know how to work out what I should call
The code is:
class TCLDAPObject(ldap.ldapobject.SimpleLDAPObject):
"""
Class which provides case-insensitive result dictionaries, as well
as default values for Trinity College.
"""
def result(self,msgid=_ldap.RES_ANY,all=1,timeout=None):
if timeout is None:
timeout = self.timeout
#pdb.set_trace()
type, data, msgid =
self._ldap_call(self._l.result2,msgid,all,timeout)
# put the data into a case-insensitive dict
if data:
newdata = []
for dn, attrs in data:
newdata.append( (dn, KIDict(attrs)) )
data = newdata
return type, data
There are two things I'm trying to achieve. First, to make it work on
the Etch system. Then to make the same code work on both the etch system
and the sarge system.
Any tips?
--
+-Geoff Crompton
+--Debian System Administrator
+---Trinity College
More information about the melbourne-pug
mailing list