diff --git a/ChangeLog b/ChangeLog index 6c131b7..351b288 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ Sat Oct 25 22:48:08 2014 +0200 Emmanuel Garette * 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 diff --git a/test/test_config.py b/test/test_config.py index ba16545..6ac48d4 100644 --- a/test/test_config.py +++ b/test/test_config.py @@ -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 diff --git a/test/test_config_domain.py b/test/test_config_domain.py index bcae92a..3edb2cb 100644 --- a/test/test_config_domain.py +++ b/test/test_config_domain.py @@ -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(): diff --git a/tiramisu/option/option.py b/tiramisu/option/option.py index 687a5a8..d311173 100644 --- a/tiramisu/option/option.py +++ b/tiramisu/option/option.py @@ -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,