[python-ldap] Struggling to implement persistent search

Michael Ströder michael at stroeder.com
Wed Apr 13 08:34:31 CEST 2011

Jeroen van Meeuwen (Kolab Systems) wrote:
> I'm trying to implement the PersistentSearchControl with
> EntryChangeNotificationControl, but the latter does not seem to have a
> encodeControlValue method.

First of all: The API for LDAP controls changed.

EntryChangeNotificationControl is only an instance of ResponseControl.

> The results I'm getting from a stand-alone PersistentSearchControl
> (using returnECs=True) however do not seem to represent the changeType
> in any way.

Please show your code. Note that ResponseControl.decodeControlValue() is
supposed to set class attributes as side effect, not to return the decoded
value anymore. Have a look at Demo/page_control.py to get the idea.

In case of EntryChangeNotificationControl the relevant class attributes are
changeType, changeNumber and previousDN.

I've only tested this with Novell eDirectory which only returns changeType and
previousDN in case of modRDN.

> Has somebody successfully implemented PersistentSearchControl with
> EntryChangeNotificationControl / changeType,

Yes. The code in ldap.controls.psearch is result of a customer project. I want
to add also some demo code in Demo/pyasn1/. Not sure when I have time to do that.

Which LDAP server are you working with?

Ciao, Michael.

More information about the python-ldap mailing list