From 4c1496b4a4d380fa62ada223819ec3cd0d523bc8 Mon Sep 17 00:00:00 2001 From: Matthieu Rigal Date: Fri, 12 Jun 2015 13:10:36 +0200 Subject: [PATCH 1/2] Updated URL and Email field regex validators, added schemes arg to urlfield --- mongoengine/fields.py | 23 ++++++++++++++++------- tests/fields/fields.py | 18 +++++++++++++++++- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/mongoengine/fields.py b/mongoengine/fields.py index 9176828c..b685534d 100644 --- a/mongoengine/fields.py +++ b/mongoengine/fields.py @@ -119,22 +119,31 @@ class URLField(StringField): """ _URL_REGEX = re.compile( - r'^(?:http|ftp)s?://' # http:// or https:// - # domain... - r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?)|' + 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,}(? Date: Fri, 12 Jun 2015 13:12:35 +0200 Subject: [PATCH 2/2] Added to changelog --- docs/changelog.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index dfa9c7a6..aba3f6b2 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -22,6 +22,7 @@ Changes in 0.9.X - DEV - No_dereference() not respected on embedded docs containing reference. #517 - Document save raise an exception if save_condition fails #1005 - Fixes some internal _id handling issue. #961 +- Updated URL and Email Field regex validators, added schemes argument to URLField validation. #652 Changes in 0.9.0 ================