Merge pull request #1893 from bagerard/swat_url_fix
(CLONE) fix - allow url with underscore in domain
This commit is contained in:
commit
acf8c3015a
@ -132,7 +132,7 @@ class URLField(StringField):
|
|||||||
|
|
||||||
_URL_REGEX = LazyRegexCompiler(
|
_URL_REGEX = LazyRegexCompiler(
|
||||||
r'^(?:[a-z0-9\.\-]*)://' # scheme is validated separately
|
r'^(?:[a-z0-9\.\-]*)://' # scheme is validated separately
|
||||||
r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}(?<!-)\.?)|' # domain...
|
r'(?:(?:[A-Z0-9](?:[A-Z0-9-_]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}(?<!-)\.?)|' # domain...
|
||||||
r'localhost|' # localhost...
|
r'localhost|' # localhost...
|
||||||
r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|' # ...or ipv4
|
r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|' # ...or ipv4
|
||||||
r'\[?[A-F0-9]*:[A-F0-9:]+\]?)' # ...or ipv6
|
r'\[?[A-F0-9]*:[A-F0-9:]+\]?)' # ...or ipv6
|
||||||
|
@ -425,6 +425,16 @@ class FieldTest(MongoDBTestCase):
|
|||||||
scheme_link.url = 'ws://google.com'
|
scheme_link.url = 'ws://google.com'
|
||||||
scheme_link.validate()
|
scheme_link.validate()
|
||||||
|
|
||||||
|
def test_url_allowed_domains(self):
|
||||||
|
"""Allow underscore in domain names.
|
||||||
|
"""
|
||||||
|
class Link(Document):
|
||||||
|
url = URLField()
|
||||||
|
|
||||||
|
link = Link()
|
||||||
|
link.url = 'https://san_leandro-ca.geebo.com'
|
||||||
|
link.validate()
|
||||||
|
|
||||||
def test_int_validation(self):
|
def test_int_validation(self):
|
||||||
"""Ensure that invalid values cannot be assigned to int fields.
|
"""Ensure that invalid values cannot be assigned to int fields.
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user