allow number as first letter of a domainname with netbios type

This commit is contained in:
Emmanuel Garette 2014-10-25 22:58:46 +02:00
parent 08f4f30bc5
commit 9ad6cd905c
4 changed files with 5 additions and 7 deletions

View File

@ -1,5 +1,6 @@
Sat Oct 25 22:48:08 2014 +0200 Emmanuel Garette <egarette@cadoles.com> Sat Oct 25 22:48:08 2014 +0200 Emmanuel Garette <egarette@cadoles.com>
* cannot add unvalaible consistency for an option * 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> Fri Jun 20 16:27:55 2014 +0200 Emmanuel Garette <egarette@cadoles.com>

View File

@ -9,6 +9,7 @@ from py.test import raises
from tiramisu.config import Config, SubConfig from tiramisu.config import Config, SubConfig
from tiramisu.option import IntOption, FloatOption, StrOption, ChoiceOption, \ from tiramisu.option import IntOption, FloatOption, StrOption, ChoiceOption, \
BoolOption, UnicodeOption, OptionDescription BoolOption, UnicodeOption, OptionDescription
from tiramisu.i18n import _
from tiramisu.error import ConflictError, ConfigError, PropertiesOptionError from tiramisu.error import ConflictError, ConfigError, PropertiesOptionError
import weakref import weakref

View File

@ -42,7 +42,7 @@ def test_special_domain_name():
c.d = '1toto.com' c.d = '1toto.com'
c.d = '123toto.com' c.d = '123toto.com'
c.e = 'toto' c.e = 'toto'
raises(ValueError, "c.e = '1toto'") c.e = '1toto'
def test_domainname_netbios(): def test_domainname_netbios():

View File

@ -411,10 +411,6 @@ class DomainnameOption(Option):
end = '' end = ''
extrachar = '' extrachar = ''
extrachar_mandatory = '' extrachar_mandatory = ''
if extra['_dom_type'] != 'netbios':
allow_number = '\d'
else:
allow_number = '' # pragma: optional cover
if extra['_dom_type'] == 'netbios': if extra['_dom_type'] == 'netbios':
length = 14 # pragma: optional cover length = 14 # pragma: optional cover
elif extra['_dom_type'] == 'hostname': elif extra['_dom_type'] == 'hostname':
@ -426,8 +422,8 @@ class DomainnameOption(Option):
else: else:
extrachar = '\.' # pragma: optional cover extrachar = '\.' # pragma: optional cover
end = '+[a-z]*' end = '+[a-z]*'
extra['_domain_re'] = re.compile(r'^(?:[a-z{0}][a-z\d\-{1}]{{,{2}}}{3}){4}$' extra['_domain_re'] = re.compile(r'^(?:[a-z\d][a-z\d\-{0}]{{,{1}}}{2}){3}$'
''.format(allow_number, extrachar, length, ''.format(extrachar, length,
extrachar_mandatory, end)) extrachar_mandatory, end))
super(DomainnameOption, self).__init__(name, doc, default=default, super(DomainnameOption, self).__init__(name, doc, default=default,
default_multi=default_multi, default_multi=default_multi,