Add argument for compatibility with python 2.6

Closes: #1651
This commit is contained in:
Florent 2014-11-18 22:43:43 +01:00
commit 656440b5ee

View file

@ -497,8 +497,8 @@ class HTMLPage(Page):
>>> len(root.xpath('//b[has-class("not-exists")]'))
0
"""
expressions = ' and '.join(["contains(concat(' ', normalize-space(@class), ' '), ' {} ')".format(c) for c in classes])
xpath = 'self::*[@class and {}]'.format(expressions)
expressions = ' and '.join(["contains(concat(' ', normalize-space(@class), ' '), ' {0} ')".format(c) for c in classes])
xpath = 'self::*[@class and {0}]'.format(expressions)
return bool(context.context_node.xpath(xpath))
ns['has-class'] = has_class