[utils] Relax attribute key assert

pull/8/head
Sergey M․ 2015-09-04 23:57:27 +06:00
rodzic a41fb80ce1
commit 5d2354f177
1 zmienionych plików z 1 dodań i 1 usunięć

Wyświetl plik

@ -141,7 +141,7 @@ def write_json_file(obj, fn):
if sys.version_info >= (2, 7):
def find_xpath_attr(node, xpath, key, val=None):
""" Find the xpath xpath[@key=val] """
assert re.match(r'^[a-zA-Z-]+$', key)
assert re.match(r'^[a-zA-Z_-]+$', key)
if val:
assert re.match(r'^[a-zA-Z0-9@\s:._-]*$', val)
expr = xpath + ('[@%s]' % key if val is None else "[@%s='%s']" % (key, val))