diff options
author | milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2013-08-21 22:01:21 +0000 |
---|---|---|
committer | milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2013-08-21 22:01:21 +0000 |
commit | ea7bd5e1c5e6f115f1a3aad94117c4b17ccf0547 (patch) | |
tree | 17be688827aaa5b75235ae71b6474ad4fd655a43 | |
parent | 96b877880ccca387b7cdae5d1aa6a1373ff4a834 (diff) | |
download | docutils-ea7bd5e1c5e6f115f1a3aad94117c4b17ccf0547.tar.gz |
Apply patch by Jakub Wilk to fix bug [ 100 ].
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@7717 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
-rw-r--r-- | HISTORY.txt | 3 | ||||
-rw-r--r-- | docutils/writers/odf_odt/__init__.py | 18 |
2 files changed, 14 insertions, 7 deletions
diff --git a/HISTORY.txt b/HISTORY.txt index 653c319ac..c1b3ec8aa 100644 --- a/HISTORY.txt +++ b/HISTORY.txt @@ -16,6 +16,9 @@ Changes Since 0.11 ================== +* docutils/writers/odf_odt/__init__.py + + - Apply patch by Jakub Wilk to fix bug [ 100 ]. Release 0.11 (2013-07-22) ========================= diff --git a/docutils/writers/odf_odt/__init__.py b/docutils/writers/odf_odt/__init__.py index f02500513..2a2222683 100644 --- a/docutils/writers/odf_odt/__init__.py +++ b/docutils/writers/odf_odt/__init__.py @@ -88,16 +88,20 @@ except ImportError: # that support for the ability to get the parent of an element. # if WhichElementTree == 'elementtree': - class _ElementInterfaceWrapper(etree._ElementInterface): + import weakref + _parents = weakref.WeakKeyDictionary() + if isinstance(etree.Element, type): + _ElementInterface = etree.Element + else: + _ElementInterface = etree._ElementInterface + class _ElementInterfaceWrapper(_ElementInterface): def __init__(self, tag, attrib=None): - etree._ElementInterface.__init__(self, tag, attrib) - if attrib is None: - attrib = {} - self.parent = None + _ElementInterface.__init__(self, tag, attrib) + _parents[self] = None def setparent(self, parent): - self.parent = parent + _parents[self] = parent def getparent(self): - return self.parent + return _parents[self] # |