Handle using provided weakrefs as stanza parent references.
Fixes issue #159
This commit is contained in:
parent
94aa6673ca
commit
cb2469322b
@ -326,7 +326,10 @@ class ElementBase(object):
|
|||||||
#: If not, then :attr:`parent` is ``None``.
|
#: If not, then :attr:`parent` is ``None``.
|
||||||
self.parent = None
|
self.parent = None
|
||||||
if parent is not None:
|
if parent is not None:
|
||||||
self.parent = weakref.ref(parent)
|
if not isinstance(parent, weakref.ReferenceType):
|
||||||
|
self.parent = weakref.ref(parent)
|
||||||
|
else:
|
||||||
|
self.parent = parent
|
||||||
|
|
||||||
if self.subitem is not None:
|
if self.subitem is not None:
|
||||||
for sub in self.subitem:
|
for sub in self.subitem:
|
||||||
|
Loading…
Reference in New Issue
Block a user