correction in allow_without_dot + test
This commit is contained in:
@@ -991,16 +991,20 @@ class DomainnameOption(Option):
|
||||
self._allow_without_dot = allow_without_dot
|
||||
end = ''
|
||||
extrachar = ''
|
||||
extrachar_mandatory = ''
|
||||
if self._type == 'netbios':
|
||||
length = 14
|
||||
elif self._type == 'hostname':
|
||||
length = 62
|
||||
elif self._type == 'domainname':
|
||||
length = 62
|
||||
extrachar = '\.'
|
||||
if allow_without_dot is False:
|
||||
extrachar_mandatory = '\.'
|
||||
else:
|
||||
extrachar = '\.'
|
||||
end = '+[a-z]*'
|
||||
self._domain_re = re.compile(r'^(?:[a-z][a-z\d\-]{{,{0}}}{1}){2}$'
|
||||
''.format(length, extrachar, end))
|
||||
self._domain_re = re.compile(r'^(?:[a-z][a-z\d\-{0}]{{,{1}}}{2}){3}$'
|
||||
''.format(extrachar, length, extrachar_mandatory, end))
|
||||
super(DomainnameOption, self).__init__(name, doc, default=default,
|
||||
default_multi=default_multi,
|
||||
callback=callback,
|
||||
|
Reference in New Issue
Block a user