Fix rfc3986.is_valid_uri deprecation warnings
The rfc3986.is_valid_uri has been deprecated in 1.1.0. It generates the following warnings. DeprecationWarning: Please use rfc3986.validators.Validator instead. This method will be eventually removed. So this patch replaces rfc3986.is_valid_uri with rfc3986.validators.Validator. Even after applying this patch, the warnings are still output because it is caused by oslo.config. The fix for oslo.config will be done in another patch. Change-Id: I70aebad6c6bd384dbd11ef732226356922bf1913 Closes-Bug: #1809755
This commit is contained in:
parent
b2f38aa0af
commit
2d2dc78975
@ -140,7 +140,7 @@ requests-mock==1.2.0
|
||||
requests==2.14.2
|
||||
requestsexceptions==1.4.0
|
||||
retrying==1.3.3
|
||||
rfc3986==0.3.1
|
||||
rfc3986==1.1.0
|
||||
Routes==2.3.1
|
||||
simplejson==3.13.2
|
||||
six==1.10.0
|
||||
|
@ -87,8 +87,17 @@ def _validate_uuid_format(instance):
|
||||
|
||||
@jsonschema.FormatChecker.cls_checks('uri')
|
||||
def _validate_uri(instance):
|
||||
return rfc3986.is_valid_uri(instance, require_scheme=True,
|
||||
require_authority=True)
|
||||
uri = rfc3986.uri_reference(instance)
|
||||
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('name_with_leading_trailing_spaces',
|
||||
|
@ -51,7 +51,7 @@ oslo.policy>=1.35.0 # Apache-2.0
|
||||
oslo.privsep>=1.23.0 # Apache-2.0
|
||||
oslo.i18n>=3.15.3 # Apache-2.0
|
||||
oslo.service>=1.33.0 # Apache-2.0
|
||||
rfc3986>=0.3.1 # Apache-2.0
|
||||
rfc3986>=1.1.0 # Apache-2.0
|
||||
oslo.middleware>=3.31.0 # Apache-2.0
|
||||
psutil>=3.2.2 # BSD
|
||||
oslo.versionedobjects>=1.33.3 # Apache-2.0
|
||||
|
Loading…
x
Reference in New Issue
Block a user