Merge "Fix rfc3986.is_valid_uri deprecation warnings"
This commit is contained in:
@@ -40,6 +40,7 @@ oslo.versionedobjects>=1.33.3 # Apache-2.0
|
|||||||
openstacksdk>=0.44.0 # Apache-2.0
|
openstacksdk>=0.44.0 # Apache-2.0
|
||||||
python-neutronclient>=6.7.0 # Apache-2.0
|
python-neutronclient>=6.7.0 # Apache-2.0
|
||||||
python-novaclient>=9.1.0 # Apache-2.0
|
python-novaclient>=9.1.0 # Apache-2.0
|
||||||
|
rfc3986>=1.1.0 # Apache-2.0
|
||||||
tosca-parser>=1.6.0 # Apache-2.0
|
tosca-parser>=1.6.0 # Apache-2.0
|
||||||
heat-translator>=2.0.0 # Apache-2.0
|
heat-translator>=2.0.0 # Apache-2.0
|
||||||
cryptography>=2.1 # BSD/Apache-2.0
|
cryptography>=2.1 # BSD/Apache-2.0
|
||||||
|
@@ -31,8 +31,16 @@ from tacker.common import exceptions as exception
|
|||||||
|
|
||||||
@jsonschema.FormatChecker.cls_checks('uri')
|
@jsonschema.FormatChecker.cls_checks('uri')
|
||||||
def _validate_uri(instance):
|
def _validate_uri(instance):
|
||||||
return rfc3986.is_valid_uri(instance, require_scheme=True,
|
uri = rfc3986.uri_reference(instance)
|
||||||
require_authority=True)
|
validator = rfc3986.validators.Validator().require_presence_of(
|
||||||
|
'scheme', 'host',
|
||||||
|
).check_validity_of(
|
||||||
|
'scheme', 'userinfo', 'host', 'path', 'query', 'fragment',)
|
||||||
|
try:
|
||||||
|
validator.validate(uri)
|
||||||
|
except rfc3986.exceptions.RFC3986Exception:
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
@jsonschema.FormatChecker.cls_checks('uuid')
|
@jsonschema.FormatChecker.cls_checks('uuid')
|
||||||
|
Reference in New Issue
Block a user