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 ================ diff --git a/mongoengine/fields.py b/mongoengine/fields.py index 94f41d28..8e6c9b07 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,}(?