Re: high level API for ldap object handling

2008-04-23 Thread Michael Ströder
Olivier,

Olivier Sessink wrote:
 
 In my use of python-ldap I've often used a self-developed high level 
 class for ldap-object handling.
 
 Adding a new ldap entry for example (ld is a python-ldap object):
 
 lo = LdapOO.LdapObject()
 lo.set_dn_attribs(['cn'])
 lo.add_attribute_value('cn','test2')
 lo.set_base_dn('ou=People,o=myorg')
 lo.add_attribute_value('objectClass','inetOrgPerson')
 lo.commit_s(ld)
 
 or modifying an existing ldap entry:
 
 res=ld.search_s('ou=People,o=fakenet',ldap.SCOPE_SUBTREE,'(sn=surname)')
 lo = LdapOO.LdapObject(res[0][0],res[0][1])
 lo.add_attribute_value('sn','surname')
 if (not lo.has_attribute('street')):
   lo.add_attribute_value('street','new street')
 lo.commit_s(ld)

Hmm, I'm not sure I would consider this to be very high-level. If a 
higher-level API is ever add to python-ldap it will definitely be 
subschema-aware to map OID to NAME aliases and some more stuff and make 
use of defaultdict stuff new in Python 2.5.

 since I use this class often, I was wondering if there are more people 
 that like such a high-level API, and perhaps this can be developed 
 further and added to python-ldap ?

I'd prefer you to release this as a separate package on your own web 
space since I wouldn't use it myself and therefore I'd not maintain it. 
If you do so I would be glad to link to your project page from 
python-ldap's web page so that others can find it easily.

Ciao, Michael.

-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
Python-LDAP-dev mailing list
Python-LDAP-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/python-ldap-dev


high level API for ldap object handling

2008-04-22 Thread Olivier Sessink
Hi all,

I've been using python-ldap a lot, thanks for the great work!

In my use of python-ldap I've often used a self-developed high level 
class for ldap-object handling.

Adding a new ldap entry for example (ld is a python-ldap object):

lo = LdapOO.LdapObject()
lo.set_dn_attribs(['cn'])
lo.add_attribute_value('cn','test2')
lo.set_base_dn('ou=People,o=myorg')
lo.add_attribute_value('objectClass','inetOrgPerson')
lo.commit_s(ld)

or modifying an existing ldap entry:

res=ld.search_s('ou=People,o=fakenet',ldap.SCOPE_SUBTREE,'(sn=surname)')
lo = LdapOO.LdapObject(res[0][0],res[0][1])
lo.add_attribute_value('sn','surname')
if (not lo.has_attribute('street')):
lo.add_attribute_value('street','new street')
lo.commit_s(ld)

since I use this class often, I was wondering if there are more people 
that like such a high-level API, and perhaps this can be developed 
further and added to python-ldap ?

regards,
Olivier Sessink


-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
Python-LDAP-dev mailing list
Python-LDAP-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/python-ldap-dev