EmailOption and URLOption : let user choose attr for DomainnameOption

This commit is contained in:
Emmanuel Garette 2013-10-01 20:01:38 +02:00
parent eb3327cd75
commit 615cad4b49
1 changed files with 0 additions and 12 deletions

View File

@ -1039,12 +1039,6 @@ class EmailOption(DomainnameOption):
_opt_type = 'email'
username_re = re.compile(r"^[\w!#$%&'*+\-/=?^`{|}~.]+$")
def __init__(self, *args, **kwargs):
kwargs['type_'] = 'domainname'
kwargs['allow_ip'] = False
kwargs['allow_without_dot'] = False
super(EmailOption, self).__init__(*args, **kwargs)
def _validate(self, value):
splitted = value.split('@', 1)
try:
@ -1063,12 +1057,6 @@ class URLOption(DomainnameOption):
proto_re = re.compile(r'(http|https)://')
path_re = re.compile(r"^[a-z0-9\-\._~:/\?#\[\]@!%\$&\'\(\)\*\+,;=]+$")
def __init__(self, *args, **kwargs):
kwargs['type_'] = 'domainname'
kwargs['allow_ip'] = False
kwargs['allow_without_dot'] = False
super(URLOption, self).__init__(*args, **kwargs)
def _validate(self, value):
match = self.proto_re.search(value)
if not match: