[python-ldap] python 2.4 python3 version

Dusan Stefanik stefanik at dscon.sk
Fri Jun 24 11:56:17 CEST 2011


Hi,

this is first version of my work.
Huge testing is needed.

Basic tests on my 64bit ubuntu (python 3.1.2) was success (search, add, modify, delete, schema search, search with control value, jpeg in/out).

There is some hacks for correct schema search working:

Schema search result in function urlfetch (subentry.py) is converted from bytes to string because models.py and tokenizer functions are string based.
So I added function By2Str()
+    subschemasubentry_entry = By2Str(subschemasubentry_entry)


Schema search is doing in few loops so I convert search attributes to bytes if needed.
ldapobject.py:
+    s2b = lambda x: x.encode() if type(x) is not bytes else x
+    #for schema search needed convert s2b
+    if(type(attrlist) is list):
+        attrlist = [ s2b(li) for li in attrlist]

Finally I made some changes on demo scripts to get it work with py3.

Dusan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: python-ldap-cvs-py3.diff
Type: text/x-diff
Size: 88525 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-ldap/attachments/20110624/c9185265/attachment-0001.diff>


More information about the python-ldap mailing list