[python-ldap] Python3 Ldap Client Library

python3ldap python3ldap at gmail.com
Wed Jul 17 22:45:41 CEST 2013


Hello everybody,
thanks for all suggestions you sent me, I've posted an alpha version of
python3-ldap on PyPi. It covers all the basic operations defined in rfc4511
and should work on Linux and Windows OS with Python3 (I'm working on
backward compatability with Python2 too). If you're interested you can send
me feedback at python3ldap at gmail.com.

I'd like to thanks Michael and I ask him for forgiveness for the intrusion
in this mailing-list. I won't send any more message here.

Have fun,
gc


2013/6/5 GG CC <python3ldap at gmail.com>

> Hi,
> I'm developing a pure python ldap client library to be used in version 3
> of Python.
>
> My mandatory requirement are:
> 1. strictly follow the latest RFC for LDAP 3 ( from rfc4510 to rfc4519)
> 2. platform independent (at least for linux and Windows) architecture
> 3. do not have any external dependence (no openldap client library)
> 4. to be compatible with python3 and (possibly) python2
> 5. have a list of connection strategies (no thread, single thread,
> multithread, event...) to choose from, either synchronous or asynchronous
> 6. have a semplified query construction language
> 7. have a compatibility mode for application using python-ldap
>
> The project will be open source. I have a basic client working (at a
> pre-alpha stage) and I'm about to create a site for hosting it. I've made a
> package submission on pypi for python3-ldap (I'm not sure if this will be
> the name), but there is no code available yet.
>
> A bit more info about the previous requirements:
>
> 1. Latest RFC for ldap v3 (dated 2006) obsoletes the previous RFC
> specified in rfc3377 (2251-2256, 2829, 2830, 3371) for ldap v3 and amend
> and clarify the ldap protocol. I've already rewritten all the asn1
> definitions from the rfc4511 because those in the pyasn1_modules package
> are not current with the RFC.
>
> 2. The library should run on Windows and Linux with no differences.
>
> 3. I usually work on Linux and Windows boxes and each time have to install
> the current python-ldap library from different sources. My library should
> be directly installed from pypi using pip or a similar package manager on
> both platforms. With python-ldap on Windows I can't use pip to update the
> library from the CheeseShop so I do not want to have any dependencies,
> installation should be the same on both platforms. Socket and thread
> programming should be appropriate for the platform used, with no changes
> needed in the configuration. My library should depend on the standard
> library and (for now) on the pyasn1 package only.
>
> 4. I'm writing and testing the library in Python 3, but it should
> (hopefully) be compatible with Python 2. Unicode strings are appropriately
> converted.
>
> 5. I'm not sure about which connection strategy is the best to use on ldap
> messages communication, so I'm writing a connection object with a
> "pluggable" socket connection strategy. For now I have "sync-nothread" and
> "async-blocking-threaded" strategies, maybe I'll add a
> "async-multiprocess-blocking" strategy and an "event-nonblocking-strategy".
>
> 6. I've already developed (for another project) an "abstraction layer" for
> ldap query. For example I can define "application fields" that maps to ldap
> attributes with a validate, prequery-transformation,
> postquery-transformation and a simplified query language. I think it could
> be helpful to extend the abstration to add/modify/delete and include this
> abstraction layer in the library to (optionally) simplify ldap usage. The
> following is an excerpt from my other project:
>
>
> # This is the definition of an abstract "Role" class mapped to an ldap
> object of class "CustomRole".
> # Fields maps to attributes (roleName to LocalizedName, roleLevel to
> RoleLevel, roleOwner to owner')
> # attr is the name of the attribute in ldap
> # multivalue fields are returned as a list of values
> # validation is a function to be executed with the value of the field. It
> it's non True the field is not added to the query
> # preQuery is a function to be executed to transform the value of the
> field before the query is executed
> # postQuery is a function to be executed to transform the response values
> of the query
> # default is a value to be returned if the query for that attribute is
> empty
>
> class Role(_ldapBase):
>     LDAPClass = 'CustomRole'
>     baseLDAP = 'ou=roles,o=company')
>     attrDefs = {
>                 'roleName': {
>                     'attr': 'CustomRoleName',
>                     'multivalue': False,
>                     'validation': None,
>                     'preQuery': lambda attrName, attrValue:
> Role._filterName('nrfLocalizedNames', AttrName, AttrValue),
>                     'postQuery': lambda a: Role._getCustomName(a),
>                     'default': 'no-role'
>                 },
>                 'roleLevel': {
>                     'attr': 'RoleLevel',
>                     'multivalue': False,
>                     'validation': lambda value: True if value in ['1',
> '2', '3'] else False,
>                     'preQuery': None,
>                     'postQuery': None,
>                     'default': ''
>                 },
>                 'roleOwner': {
>                     'attr': 'owner',
>                     'multivalue': True,
>                     'validation': None,
>                     'preQuery': None,
>                     'postQuery': None,
>                     'default': []
>                 },
>     }
>
> when I execute a query on this class I can use something like:
>     roleName:admin,user roleLevel:3
> and get the result for the following search filter:
>     (&(|(CustomRoleName=admin_role)(CustomRoleName=admin_role))(RoleLevel
> = 3)).
>
>
> 7. I have developed different projects that use the python-ldap library.
> I'd like to convert them to python3 without changing what I've already done
> for the ldap part. So it should be (ideally) enough just to change the
> import from python-ldap to python3-ldap (or whatever the name of the
> library will be).
>
> I'm writing in this list to know if anybody is interested in this kind of
> project and have suggestions or hints on how to go on.
>
> Thanks,
> gc
>
> ps. I admit the reading RFCs is not one of the most interesting things to
> do in your spare time...
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ldap/attachments/20130717/1988cb54/attachment.html>


More information about the python-ldap mailing list