Minor bug in ldif.py

David Leonard david.leonard at csee.uq.edu.au
Mon Jun 4 05:05:25 CEST 2001


On Thu, 31 May 2001, Roger Moore typed thusly:

> I just noticed a slight bug in ldif.py to do with the deletion of the
> object class list. The problem is that if you name the attribute
> 'objectClass' then the first attrs.remove() statement generates an
> exception and the second statement is not reached. To fix this you can
> check for the key first. I've attached the patch to this email.
>
> As a very quick work around call the attribute 'objectclass'.

i have committed a different fix.
michael, you should check that this is right.

d

----------------------------
revision 1.3
date: 2001/06/04 03:05:26;  author: leonard;  state: Exp;  lines: +6 -0
add RCS tag
fix bug found by Roger Moore <rwmoore at fnal.gov> where objectclass
attributes weren't always removed

Index: ldif.py
===================================================================
RCS file: /cvsroot/python-ldap/python-ldap/Lib/ldif.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ldif.py	2001/05/07 17:25:42	1.2
+++ ldif.py	2001/06/04 03:05:26	1.3
@@ -1,3 +1,6 @@
+# python
+# $Id: ldif.py,v 1.3 2001/06/04 03:05:26 leonard Exp $
+
 """
 ldif.py - Various routines for handling LDIF data

@@ -81,6 +84,9 @@
   attrs = entry.keys()[:]
   try:
     attrs.remove('objectclass')
+  except ValueError:
+    pass
+  try:
     attrs.remove('objectClass')
   except ValueError:
     pass

-- 
David Leonard                           David.Leonard at dstc.edu.au
DSTC                                    Room:78-632  Ph:+61 7 336 58358
The University of Queensland            http://www.dstc.edu.au/
QLD 4072  AUSTRALIA                     B73CD65FBEF4C089B79A8EBADF1A932F13EA0FC8

I put my chin on my knee, and looked for flaws in the soft grain of my
beige plastic monitor casing. - Julian Assange





More information about the python-ldap mailing list