Skip to content

Commit 1695b20

Browse files
Merge pull request #55 from insightindustry/develop
Release of v.1.4.1.
2 parents 298f79f + e2d415f commit 1695b20

File tree

7 files changed

+43
-31
lines changed

7 files changed

+43
-31
lines changed

CHANGES.rst

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
-----------
22

3+
Release 1.4.1 (released January 1, 2020)
4+
============================================
5+
6+
* #54: Fixed the incorrect raising of a ``TypeError`` by ``validators.url()``.
7+
8+
-----------
9+
310
Release 1.4.0 (released December 21, 2019)
411
============================================
512

README.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,18 @@ Validator Collection
2525
:target: http://validator-collection.readthedocs.io/en/latest/?badge=latest
2626
:alt: Documentation Status (ReadTheDocs)
2727

28-
* - `v. 1.4 <https://github.com/insightindustry/validator-collection/tree/v.1.4.0>`_
28+
* - `v. 1.4 <https://github.com/insightindustry/validator-collection/tree/v.1.4.1>`_
2929
-
30-
.. image:: https://travis-ci.org/insightindustry/validator-collection.svg?branch=v.1.4.0
30+
.. image:: https://travis-ci.org/insightindustry/validator-collection.svg?branch=v.1.4.1
3131
:target: https://travis-ci.org/insightindustry/validator-collection
3232
:alt: Build Status (Travis CI)
3333

34-
.. image:: https://codecov.io/gh/insightindustry/validator-collection/branch/v.1.4.0/graph/badge.svg
34+
.. image:: https://codecov.io/gh/insightindustry/validator-collection/branch/v.1.4.1/graph/badge.svg
3535
:target: https://codecov.io/gh/insightindustry/validator-collection
3636
:alt: Code Coverage Status (Codecov)
3737

38-
.. image:: https://readthedocs.org/projects/validator-collection/badge/?version=v.1.4.0
39-
:target: http://validator-collection.readthedocs.io/en/latest/?badge=v.1.4.0
38+
.. image:: https://readthedocs.org/projects/validator-collection/badge/?version=v.1.4.1
39+
:target: http://validator-collection.readthedocs.io/en/latest/?badge=v.1.4.1
4040
:alt: Documentation Status (ReadTheDocs)
4141

4242
* - `v. 1.3 <https://github.com/insightindustry/validator-collection/tree/v.1.3.8>`_

docs/_unit_tests_code_coverage.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@
1818
:target: http://validator-collection.readthedocs.io/en/latest/?badge=latest
1919
:alt: Documentation Status (ReadTheDocs)
2020

21-
* - `v. 1.4 <https://github.com/insightindustry/validator-collection/tree/v.1.4.0>`_
21+
* - `v. 1.4 <https://github.com/insightindustry/validator-collection/tree/v.1.4.1>`_
2222
-
23-
.. image:: https://travis-ci.org/insightindustry/validator-collection.svg?branch=v.1.4.0
23+
.. image:: https://travis-ci.org/insightindustry/validator-collection.svg?branch=v.1.4.1
2424
:target: https://travis-ci.org/insightindustry/validator-collection
2525
:alt: Build Status (Travis CI)
2626

27-
.. image:: https://codecov.io/gh/insightindustry/validator-collection/branch/v.1.4.0/graph/badge.svg
27+
.. image:: https://codecov.io/gh/insightindustry/validator-collection/branch/v.1.4.1/graph/badge.svg
2828
:target: https://codecov.io/gh/insightindustry/validator-collection
2929
:alt: Code Coverage Status (Codecov)
3030

31-
.. image:: https://readthedocs.org/projects/validator-collection/badge/?version=v.1.4.0
32-
:target: http://validator-collection.readthedocs.io/en/latest/?badge=v.1.4.0
31+
.. image:: https://readthedocs.org/projects/validator-collection/badge/?version=v.1.4.1
32+
:target: http://validator-collection.readthedocs.io/en/latest/?badge=v.1.4.1
3333
:alt: Documentation Status (ReadTheDocs)
3434

3535
* - `v. 1.3 <https://github.com/insightindustry/validator-collection/tree/v.1.3.8>`_

tests/test_checkers.py

+2
Original file line numberDiff line numberDiff line change
@@ -1376,6 +1376,8 @@ def test_is_email(value, fails, allow_empty):
13761376
(u"http://LOCALHOST/test_is_lowercase", False, False, True),
13771377
(u"http://LocalHost/test_is_MIXED", False, False, True),
13781378
1379+
(u"invalid-url", True, False, True),
1380+
13791381
])
13801382
def test_is_url(value, fails, allow_empty, allow_special_ips):
13811383
expects = not fails

tests/test_validators.py

+2
Original file line numberDiff line numberDiff line change
@@ -1476,6 +1476,8 @@ def test_executable(fs, value, fails, allow_empty):
14761476
(u"http://localHOST", False, False, True),
14771477
(u"http://LOCALHOST/test_is_lowercase", False, False, True),
14781478
(u"http://LocalHost/test_is_MIXED", False, False, True),
1479+
1480+
(u"invalid-url", True, False, True),
14791481
])
14801482
def test_url(value, fails, allow_empty, allow_special_ips):
14811483
"""Test the URL validator."""

validator_collection/_version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# -*- coding: utf-8 -*-
2-
__version__ = '1.4.0'
2+
__version__ = '1.4.1'

validator_collection/validators.py

+21-20
Original file line numberDiff line numberDiff line change
@@ -2430,27 +2430,28 @@ def url(value,
24302430
stripped_value = value.replace(protocol, '')
24312431
lowercase_stripped_value = stripped_value.lower()
24322432

2433-
for special_use_domain in SPECIAL_USE_DOMAIN_NAMES:
2434-
if special_use_domain in lowercase_stripped_value:
2435-
has_port = False
2436-
port_index = lowercase_stripped_value.find(':')
2437-
if port_index > -1:
2438-
has_port = True
2439-
lowercase_stripped_value = lowercase_stripped_value[:port_index]
2440-
if not has_port:
2441-
path_index = lowercase_stripped_value.find('/')
2442-
if path_index > -1:
2443-
lowercase_stripped_value = lowercase_stripped_value[:path_index]
2444-
2445-
if lowercase_stripped_value:
2446-
try:
2447-
domain(lowercase_stripped_value,
2448-
allow_empty = False,
2449-
is_recursive = is_recursive)
2450-
is_valid = True
2433+
if lowercase_stripped_value:
2434+
for special_use_domain in SPECIAL_USE_DOMAIN_NAMES:
2435+
if special_use_domain in lowercase_stripped_value:
2436+
has_port = False
2437+
port_index = lowercase_stripped_value.find(':')
2438+
if port_index > -1:
2439+
has_port = True
2440+
lowercase_stripped_value = lowercase_stripped_value[:port_index]
2441+
if not has_port:
2442+
path_index = lowercase_stripped_value.find('/')
2443+
if path_index > -1:
2444+
lowercase_stripped_value = lowercase_stripped_value[:path_index]
2445+
2446+
if lowercase_stripped_value:
2447+
try:
2448+
domain(lowercase_stripped_value,
2449+
allow_empty = False,
2450+
is_recursive = is_recursive)
2451+
is_valid = True
24512452

2452-
except (ValueError, TypeError):
2453-
pass
2453+
except (ValueError, TypeError):
2454+
pass
24542455

24552456
if not is_valid and allow_special_ips:
24562457
try:

0 commit comments

Comments
 (0)