From 7a9a86af3d2406ef921ae2d5f8ba7e42eeff973d Mon Sep 17 00:00:00 2001 From: Nathan Fritz Date: Fri, 15 Jan 2010 21:36:53 -0800 Subject: [PATCH] fixed matcher bug introduced with stanza matching --- sleekxmpp/xmlstream/matcher/xmlmask.py | 3 ++- sleekxmpp/xmlstream/matcher/xpath.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/sleekxmpp/xmlstream/matcher/xmlmask.py b/sleekxmpp/xmlstream/matcher/xmlmask.py index 1cd1964..e4a22fa 100644 --- a/sleekxmpp/xmlstream/matcher/xmlmask.py +++ b/sleekxmpp/xmlstream/matcher/xmlmask.py @@ -16,7 +16,8 @@ class MatchXMLMask(base.MatcherBase): self.default_ns = ns def match(self, xml): - xml = xml.xml + if hasattr(xml, 'xml'): + xml = xml.xml return self.maskcmp(xml, self._criteria, True) def maskcmp(self, source, maskobj, use_ns=False, default_ns='__no_ns__'): diff --git a/sleekxmpp/xmlstream/matcher/xpath.py b/sleekxmpp/xmlstream/matcher/xpath.py index 5e0411e..fe18a65 100644 --- a/sleekxmpp/xmlstream/matcher/xpath.py +++ b/sleekxmpp/xmlstream/matcher/xpath.py @@ -6,7 +6,8 @@ ignore_ns = False class MatchXPath(base.MatcherBase): def match(self, xml): - xml = xml.xml + if hasattr(xml, 'xml'): + xml = xml.xml x = cElementTree.Element('x') x.append(xml) if not ignore_ns: