allow number as first letter of a domainname with netbios type
This commit is contained in:
parent
08f4f30bc5
commit
9ad6cd905c
|
@ -1,5 +1,6 @@
|
|||
Sat Oct 25 22:48:08 2014 +0200 Emmanuel Garette <egarette@cadoles.com>
|
||||
* cannot add unvalaible consistency for an option
|
||||
* allow number as first letter of a domainname with netbios type
|
||||
|
||||
Fri Jun 20 16:27:55 2014 +0200 Emmanuel Garette <egarette@cadoles.com>
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ from py.test import raises
|
|||
from tiramisu.config import Config, SubConfig
|
||||
from tiramisu.option import IntOption, FloatOption, StrOption, ChoiceOption, \
|
||||
BoolOption, UnicodeOption, OptionDescription
|
||||
from tiramisu.i18n import _
|
||||
from tiramisu.error import ConflictError, ConfigError, PropertiesOptionError
|
||||
import weakref
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ def test_special_domain_name():
|
|||
c.d = '1toto.com'
|
||||
c.d = '123toto.com'
|
||||
c.e = 'toto'
|
||||
raises(ValueError, "c.e = '1toto'")
|
||||
c.e = '1toto'
|
||||
|
||||
|
||||
def test_domainname_netbios():
|
||||
|
|
|
@ -411,10 +411,6 @@ class DomainnameOption(Option):
|
|||
end = ''
|
||||
extrachar = ''
|
||||
extrachar_mandatory = ''
|
||||
if extra['_dom_type'] != 'netbios':
|
||||
allow_number = '\d'
|
||||
else:
|
||||
allow_number = '' # pragma: optional cover
|
||||
if extra['_dom_type'] == 'netbios':
|
||||
length = 14 # pragma: optional cover
|
||||
elif extra['_dom_type'] == 'hostname':
|
||||
|
@ -426,8 +422,8 @@ class DomainnameOption(Option):
|
|||
else:
|
||||
extrachar = '\.' # pragma: optional cover
|
||||
end = '+[a-z]*'
|
||||
extra['_domain_re'] = re.compile(r'^(?:[a-z{0}][a-z\d\-{1}]{{,{2}}}{3}){4}$'
|
||||
''.format(allow_number, extrachar, length,
|
||||
extra['_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