Playing around with python-ldap, your patches and search continuations...

Sascha Gresk sascha at free.de
Wed Feb 7 16:41:40 CET 2001


On Wed, 07 Feb 2001, Konstantin Chuguev wrote:
> Date: Wed, 07 Feb 2001 13:26:49 +0000
> To: Michael Ströder <michael at stroeder.com>
> From: Konstantin Chuguev <Konstantin.Chuguev at dante.org.uk>
> Subject: Re: Playing around with python-ldap, your patches and search 
>  continuations...
> 
> Hi Michael,
> 
> [CC'ing to the python-ldap list in case somebody would like to
> comment...]
> 
> Michael Ströder wrote:
> 
> > Konstantin Chuguev wrote:
> > >
> > > I completely agree with the idea of having a separate package
> supporting
> > > OpenLDAPv2 only.
> >
> > Yes. But how this will be built wasn't clear. Sascha proposed using
> > SWIG.
> >

Using SWIG isnt as simple as the name might appear, so this might intruduce
an extra difficulty for people trying to help develop python-ldap.

> 
> I've got some questions on that, which I couldn't find on the SWIG web
> site:
> - Does SWIG work with Python 2?

Yes. Using Python2 solved some dynamic loading problems I had on solaris.

> - How C preprocessor constants (#define ...) are converted to Python by
> SWIG?

I have handcrafted an extra file for this (this was indeed simple):

... snipp ...

const int SUCCESS=0x00;
const int OPERATIONS_ERROR=0x01;
const int PROTOCOL_ERROR=0x02;
const int TIMELIMIT_EXCEEDED=0x03;
const int SIZELIMIT_EXCEEDED=0x04;
const int COMPARE_FALSE=0x05;
const int COMPARE_TRUE=0x06;

.. snipp ...

> I suppose one will need to create C constants corresponding to the macros
> manually.

Yes ;-) 

> - In the mailing list, Sascha Gresk said: "- swig does not currently
> parse
> every conceivable type of C declaration"; can you name any particular
> type
> causing trouble?

Try to parse the supplied ldap.h - you will see SWIG needs a some more
friendly version of this header. Everything not being recognized is being
treated 
as a simple pointer. Its possible to change this behaviour by using
so-called "typemaps",
for example if you would want a char ** to act more like a list of strings,
you would start writing
a typemap....

If you would like to get an impression of LDAP and SWIG you might download
this from http://www.free.de/homes/sascha/swig-ldap  ...

Swig-ldap is far from complete but it is used in a productive envirionment
and
is known to be running on freebsd and solaris platforms (There is no reason
why it shouldn't be also running on linux, openbsd or hurd). 

Some lucky day I''ll  support openldap2.X ....


Sascha


PS: today I was reading the LDAP-JAVA-API send to this list. I agree its
an good idea to have some kind of documentation like this for python-ldap
as well.

PSPS: A set of tests included by python-ldap would be a nice thing to have.
I have
included a silly implementation for ldapsearch and ldapadd in swig-ldap to
test its
behaviour and to provide a working example ...



Sascha

> 
> Regards,
>     Konstantin.
> 
> --
>           * *        Konstantin Chuguev - Application Engineer
>        *      *              Francis House, 112 Hills Road
>      *                       Cambridge CB2 1PQ, United Kingdom
>  D  A  N  T  E       WWW:    http://www.dante.net
> 
> 
> 
> 
> 


More information about the python-ldap mailing list