URLOption: allow uppercase in resource name

This commit is contained in:
2015-04-19 09:46:39 +02:00
parent 2c6275ffbd
commit 072246a203
5 changed files with 40 additions and 37 deletions

View File

@ -506,7 +506,7 @@ class EmailOption(DomainnameOption):
class URLOption(DomainnameOption):
__slots__ = tuple()
proto_re = re.compile(r'(http|https)://')
path_re = re.compile(r"^[a-z0-9\-\._~:/\?#\[\]@!%\$&\'\(\)\*\+,;=]+$")
path_re = re.compile(r"^[A-Za-z0-9\-\._~:/\?#\[\]@!%\$&\'\(\)\*\+,;=]+$")
def _validate(self, value, context=undefined):
self._impl_valid_unicode(value)
@ -538,7 +538,7 @@ class URLOption(DomainnameOption):
super(URLOption, self)._second_level_validation(domain, False)
# validate file
if files is not None and files != '' and not self.path_re.search(files):
raise ValueError(_('invalid url, must ends with filename')) # pragma: optional cover
raise ValueError(_('invalid url, must ends with a valid resource name')) # pragma: optional cover
def _second_level_validation(self, value, warnings_only):
pass