Skip to content

class Entry doesn't work when etree = xml.etree : __str__ #1

Description

@richard-jones

[Migrated from bitbucket https://bitbucket.org/richardjones/python-sword2/issue/2/class-entry-doesnt-work-when-etree]

Entry.str fails when trying to serialise the namespace map (self.nsmap):

File "sword2/atom_objects.py", line 250, in str xml_str = etree.tostring(self.entry) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py", line 1121, in tostring ElementTree(element).write(file, encoding, method=method) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py", line 815, in write serialize(write, self._root, encoding, qnames, namespaces) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py", line 934, in _serialize_xml _serialize_xml(write, e, encoding, qnames, None) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py", line 927, in _serialize_xml v = _escape_attrib(v, encoding) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py", line 1087, in _escape_attrib _raise_serialization_error(text) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py", line 1047, in _raise_serialization_error "cannot serialize %r (type %s)" % (text, type(text).name) TypeError: cannot serialize {'dcterms': 'http://purl.org/dc/terms/', 'atom': 'http://www.w3.org/2005/Atom'} (type dict)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions