Handle using provided weakrefs as stanza parent references.
Fixes issue #159
This commit is contained in:
parent
94aa6673ca
commit
cb2469322b
1 changed files with 4 additions and 1 deletions
|
@ -326,7 +326,10 @@ class ElementBase(object):
|
|||
#: If not, then :attr:`parent` is ``None``.
|
||||
self.parent = 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:
|
||||
for sub in self.subitem:
|
||||
|
|
Loading…
Reference in a new issue