diff options
author | Lance Stout <lancestout@gmail.com> | 2012-04-14 11:13:38 -0400 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2012-04-14 11:13:38 -0400 |
commit | cb2469322b68cfc0c3761fdcb0cd6acafa0a3647 (patch) | |
tree | 359391f65d51c809af0c3f0e1d1cfe4fb2b077f6 /sleekxmpp/xmlstream | |
parent | 94aa6673cab5bf79648ac666dc62f48b064bb845 (diff) | |
download | slixmpp-cb2469322b68cfc0c3761fdcb0cd6acafa0a3647.tar.gz slixmpp-cb2469322b68cfc0c3761fdcb0cd6acafa0a3647.tar.bz2 slixmpp-cb2469322b68cfc0c3761fdcb0cd6acafa0a3647.tar.xz slixmpp-cb2469322b68cfc0c3761fdcb0cd6acafa0a3647.zip |
Handle using provided weakrefs as stanza parent references.
Fixes issue #159
Diffstat (limited to 'sleekxmpp/xmlstream')
-rw-r--r-- | sleekxmpp/xmlstream/stanzabase.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sleekxmpp/xmlstream/stanzabase.py b/sleekxmpp/xmlstream/stanzabase.py index e1a2085a..2f6416d5 100644 --- a/sleekxmpp/xmlstream/stanzabase.py +++ b/sleekxmpp/xmlstream/stanzabase.py @@ -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: |