allows a DomainnameOption to start with a number
This commit is contained in:
parent
d5b83c123c
commit
716d2b2348
|
@ -16,7 +16,7 @@ def test_domainname():
|
|||
raises(ValueError, "c.d = 'toto'")
|
||||
c.d = 'toto3.com'
|
||||
raises(ValueError, "c.d = 'toto3.3la'")
|
||||
raises(ValueError, "c.d = '3toto.com'")
|
||||
#raises(ValueError, "c.d = '3toto.com'")
|
||||
raises(ValueError, "c.d = 'toto.co3'")
|
||||
raises(ValueError, "c.d = 'toto_super.com'")
|
||||
c.d = 'toto-.com'
|
||||
|
@ -25,6 +25,15 @@ def test_domainname():
|
|||
c.f = 'toto.com'
|
||||
c.f = 'toto'
|
||||
|
||||
def test_domainname_special():
|
||||
"""domain name option that starts with a number
|
||||
"""
|
||||
d = DomainnameOption('d', '')
|
||||
od = OptionDescription('a', '', [d])
|
||||
c = Config(od)
|
||||
c.read_write()
|
||||
c.d = '1toto.com'
|
||||
c.d = '123toto.com'
|
||||
|
||||
def test_domainname_netbios():
|
||||
d = DomainnameOption('d', '', type_='netbios')
|
||||
|
|
|
@ -1004,7 +1004,7 @@ class DomainnameOption(Option):
|
|||
else:
|
||||
extrachar = '\.'
|
||||
end = '+[a-z]*'
|
||||
self._domain_re = re.compile(r'^(?:[a-z][a-z\d\-{0}]{{,{1}}}{2}){3}$'
|
||||
self._domain_re = re.compile(r'^(?:[a-z\d][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,
|
||||
|
|
Loading…
Reference in New Issue