Hi, 2009/5/16 Michael Ströder <mich...@stroeder.com>: > Guruprasad wrote: >> 2009/5/16 Michael Ströder <mich...@stroeder.com>: >>> Guruprasad wrote: >>>> Hi, >>>> I tried generating a LDIF file from a dictionary using 'ldif' module >>>> as illustrated in http://www.python-ldap.org/doc/html/ldif.html. But >>>> at the end of the LDIF data, I get a newline and a 'None', whereas >>>> there is no such thing in the result shown in that example. How to get >>>> rid of those unwanted characters. I am using Python-LDAP 2.3.5-1 on >>>> Debian Lenny. >>> Could you please post your code (in a short form) demonstrating the >>> issue? Note that there is a new-line after each entry record. But was >>> 'None' is in your case is not clear to me. >>> >> >> Basically what I am trying to do with this code is that, I manipulate >> the result returned by ldapsearch to remove some attributes and >> generate a LDIF output for the modified entry. >> >> <code> >> res_type, result_data=l.result(res_id,0) >> if (result_data==[]): >> break >> dn=result_data[0][0] >> resd=result_data[0][1] >> resd["objectClass"].remove("inetLocalMailRecipient") >> resd["objectClass"].remove("organizationalPerson") >> resd["objectClass"].remove("inetOrgPerson") >> resd["objectClass"].remove("posixAccount") >> lw=ldif.LDIFWriter(sys.stdout) >> guru=lw.unparse(dn,resd) >> print guru >> </code> > > Your code looks like processing of LDAP search results (because of the > res_type). I'd recommend to look at the actual data in dictionary resd. > Also note that the identiation seems wrong. This could be because of > cut&paste to your MUA from the editor with different tab-interpretation. > But make sure identiation is correct in the real code. > > Ciao, Michael. >
The indentation is correct in the real code. The dictionary 'resd' has the values returned by the ldapsearch and there is no 'None' anywhere in it. Thank you. Regards, Guruprasad. ------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects _______________________________________________ Python-LDAP-dev mailing list Python-LDAP-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/python-ldap-dev