allfro/canari — pull request #36 by reenberg (2014-09-02 18:45:55+00:00)
Title: Fix stupid defaults in safedexml.

We are dealing with ordinarry XML so threat it that way.

It was impossible to parse the following valid XML from Maltego, without
this fix, as it required the elements to be ordered according to how
they were defined in the c.m.m._Entity class.

---------------------------------------------------------------------------

import canari.maltego.message as msg

msg._Entity.parse('''

paterva.com

66
paterva.com

''')

---------------------------------------------------------------------------
ParseError Traceback (most recent call last)
in ()
7 paterva.com
8
----> 9 ''')

/usr/local/lib/python2.7/dist-packages/safedexml/__init__.py in
parse(cls, xml)
351 if field.required and field not in fields_found:
352 err = "required field not found: '%s'"
% (field.field_name,)
--> 353 raise ParseError(err)
354 field.parse_done(self)
355 # All done, return the instance so created

ParseError: required field not found: 'value'