Problem parsing LDIF change records
roland.hedberg at adm.umu.se
Fri Sep 29 09:33:34 CEST 2006
I'm having problem with LDIFParser and LDIF change records.
I'm using 2.2.0 which to my knowledge is the last official release.
The problematic line is line 382 in LDIFParser.parse(), the last one of
the following snippet.
# attr type and value pair was DN of LDIF record
if dn is None:
raise ValueError, 'Read changetype: before getting valid dn:
raise ValueError, 'Two lines starting with changetype: in
if not valid_changetype_dict.has_key(attr_value):
raise ValueError, 'changetype value %s is invalid.' %
dn = attr_value
What happens here is that you replace the dn value, that you earlier has
picked up from the LDIF record, with the change type.
There is no easy way to figure out the dn later in the process and if
you like me really, really need the dn then you're lost.
So, to solve my problem, I've change the last line to:
changetype = attr_value
And then futher down the line
Which of course means I have to change the definition of handle to
I get the impression from the code that this was the intention but then
somehow the coder got sidestepped :-)
More information about the python-ldap