Unicode fix reverted but can have custom validator

MongoEngine/mongoengine#136
This commit is contained in:
Ross Lawley
2012-10-01 14:48:53 +00:00
parent 6f0a6df4f6
commit e6d796832e
4 changed files with 5 additions and 10 deletions

View File

@@ -118,11 +118,8 @@ class URLField(StringField):
def validate(self, value):
if not self.url_regex.match(value):
scheme, netloc, path, query, fragment = urlparse.urlsplit(value)
try:
netloc = netloc.encode('idna') # IDN -> ACE
except UnicodeError: # invalid domain part
self.error('Invalid URL: %s' % value)
self.error('Invalid URL: %s' % value)
return
if self.verify_exists:
warnings.warn(