Restrict elementpath exceptions usage to ElementPathError
- Use only the base exception, others are derivation also of built-in exceptions.
This commit is contained in:
parent
7fce51361e
commit
0e9a3cb4c0
|
@ -13,7 +13,7 @@ This module contains declarations and classes for XML Schema constraint facets.
|
|||
"""
|
||||
from __future__ import unicode_literals
|
||||
import re
|
||||
from elementpath import XPath2Parser, ElementPathSyntaxError, ElementPathTypeError, datatypes
|
||||
from elementpath import XPath2Parser, ElementPathError, datatypes
|
||||
|
||||
from ..compat import unicode_type, MutableSequence
|
||||
from ..qnames import XSD_LENGTH, XSD_MIN_LENGTH, XSD_MAX_LENGTH, XSD_ENUMERATION, XSD_WHITE_SPACE, \
|
||||
|
@ -665,7 +665,7 @@ class XsdAssertionFacet(XsdFacet):
|
|||
|
||||
try:
|
||||
self.token = self.parser.parse(self.path)
|
||||
except (ElementPathSyntaxError, ElementPathTypeError) as err:
|
||||
except ElementPathError as err:
|
||||
self.parse_error(err, elem=self.elem)
|
||||
self.token = self.parser.parse('true()')
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ This module contains classes for other XML Schema identity constraints.
|
|||
from __future__ import unicode_literals
|
||||
import re
|
||||
from collections import Counter
|
||||
from elementpath import Selector, XPath1Parser, ElementPathSyntaxError, ElementPathKeyError
|
||||
from elementpath import Selector, XPath1Parser, ElementPathError
|
||||
|
||||
from ..exceptions import XMLSchemaValueError
|
||||
from ..qnames import XSD_UNIQUE, XSD_KEY, XSD_KEYREF, XSD_SELECTOR, XSD_FIELD
|
||||
|
@ -66,7 +66,7 @@ class XsdSelector(XsdComponent):
|
|||
|
||||
try:
|
||||
self.xpath_selector = Selector(self.path, self.namespaces, parser=XsdIdentityXPathParser)
|
||||
except (ElementPathSyntaxError, ElementPathKeyError) as err:
|
||||
except ElementPathError as err:
|
||||
self.parse_error(err)
|
||||
self.xpath_selector = Selector('*', self.namespaces, parser=XsdIdentityXPathParser)
|
||||
|
||||
|
|
Loading…
Reference in New Issue