python-ldap ticket #2829057

Rich Megginson rmeggins at redhat.com
Fri Oct 1 19:11:24 CEST 2010


Michael Ströder wrote:
> Rich Megginson wrote:
>   
>> I have some patches, and I've built them locally.  How do I set up my
>> environment to test them, on a machine with python2.4 and python-ldap
>> already installed in the system python site-packages directory?
>>     
>
> If you built with
>
> python setup.py build
>
> you have now everything compiled under build/.
> You can then install with
>
> python setup.py install
>
> but this overwrites or conflicts with an already installed packaged version of
> python-ldap.
>
> Files get installed into
> /usr/lib/python2.4/site-packages/
> or
> /usr/local/lib/python2.4/site-packages/
> depending on your Python package.
>
> Ciao, Michael.
>   
This patch adds support for returning per entry/per reference/per 
partial result controls.  The LDAPObject result3 method is extended with 
3 additional and optional arguments:
  def 
result3(self,msgid=ldap.RES_ANY,all=1,timeout=None,add_ctrls=0,add_intermediates=0,add_extop=0):

add_ctrls - if this is non-zero, per entry/ref/intermediate controls 
will be added to the tuple representing each item
for entries, this will be (dn, entrydata, controllist) where controllist 
is a List of control tuples, each one consisting of the string oid, the 
boolean iscrit, and the control value - for references, this will be a 
tuple consisting of None, the list of references, and the controllist - 
for partial/intermediate results, this will be a tuple consisting of the 
msgtype (LDAP_RES_INTERMEDIATE), the returned oid, the returned value, 
and the control list

add_intermediates - if this is non-zero, intermediate/partial result 
responses to extended operations will be processed - this could be 
useful for implementing a LDAPSync client

add_extop - if this is non-zero, extended operation results will be 
returned (which I don't think is very useful now, since python-ldap does 
not support calling ldap_extended_operation(_s) directly) - this changes 
the tuple returned by result3 to include two additional items - the 
extended operation response oid, and the extended operation response value

With this, I was able to successfully use the Dereference Control with 
389.  I tested like this, on RHEL5 x86_64, with openldap 2.3 installed 
(and python-ldap, but I was able to use my local one instead):
python setup.py build
PYTHONPATH=build/lib.linux-x86_64-2.4:/share/scripts python 
/share/scripts/dereftest.py


-------------- next part --------------
A non-text attachment was scrubbed...
Name: entrycontrols.patch
Type: text/x-patch
Size: 14957 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-ldap/attachments/20101001/453a5c65/attachment.bin>


More information about the python-ldap mailing list