Handle using provided weakrefs as stanza parent references.

Fixes issue #159
This commit is contained in:
Lance Stout 2012-04-14 11:13:38 -04:00
parent 94aa6673ca
commit cb2469322b

View file

@ -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: