diff options
author | Nathan Fritz <fritzy@netflint.net> | 2009-07-11 20:34:27 +0000 |
---|---|---|
committer | Nathan Fritz <fritzy@netflint.net> | 2009-07-11 20:34:27 +0000 |
commit | a280e3c1405f55dfd372337f5d377212ed717833 (patch) | |
tree | 66fef097c77ef9d1eae8e69ba39dc8cf3273e0b8 /sleekxmpp/xmlstream/matcher/xmlmask.py | |
parent | d9b812a73bacdd12b432eedb24edc7de565f6feb (diff) | |
download | slixmpp-a280e3c1405f55dfd372337f5d377212ed717833.tar.gz slixmpp-a280e3c1405f55dfd372337f5d377212ed717833.tar.bz2 slixmpp-a280e3c1405f55dfd372337f5d377212ed717833.tar.xz slixmpp-a280e3c1405f55dfd372337f5d377212ed717833.zip |
xmlmask now ignores namespace on subdomains properly if ignore_ns is set
Diffstat (limited to 'sleekxmpp/xmlstream/matcher/xmlmask.py')
-rw-r--r-- | sleekxmpp/xmlstream/matcher/xmlmask.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sleekxmpp/xmlstream/matcher/xmlmask.py b/sleekxmpp/xmlstream/matcher/xmlmask.py index 30cb13bb..a1610489 100644 --- a/sleekxmpp/xmlstream/matcher/xmlmask.py +++ b/sleekxmpp/xmlstream/matcher/xmlmask.py @@ -41,6 +41,18 @@ class MatchXMLMask(base.MatcherBase): return False #for subelement in maskobj.getiterator()[1:]: #recursively compare subelements for subelement in maskobj: #recursively compare subelements - if not self.maskcmp(source.find(subelement.tag), subelement, use_ns): - return False + if use_ns: + if not self.maskcmp(source.find(subelement.tag), subelement, use_ns): + return False + else: + if not self.maskcmp(self.getChildIgnoreNS(source, subelement.tag), subelement, use_ns): + return False return True + + def getChildIgnoreNS(self, xml, tag): + tag = tag.split('}')[-1] + try: + idx = [c.tag.split('}')[-1] for c in xml.getchildren()].index(tag) + except ValueError: + return None + return xml.getchildren()[idx] |