mirror of
https://github.com/correl/SleekXMPP.git
synced 2024-11-24 03:00:15 +00:00
xmlmask now ignores namespace on subdomains properly if ignore_ns is set
This commit is contained in:
parent
d9b812a73b
commit
a280e3c140
1 changed files with 14 additions and 2 deletions
|
@ -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 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]
|
||||
|
|
Loading…
Reference in a new issue