allow number as first letter of a domainname with netbios type
authorEmmanuel Garette <egarette@cadoles.com>
Sat, 25 Oct 2014 20:58:46 +0000 (22:58 +0200)
committerEmmanuel Garette <egarette@cadoles.com>
Sat, 25 Oct 2014 20:58:46 +0000 (22:58 +0200)
ChangeLog
test/test_config.py
test/test_config_domain.py
tiramisu/option/option.py

index 6c131b7..351b288 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
index ba16545..6ac48d4 100644 (file)
@@ -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
 
index bcae92a..3edb2cb 100644 (file)
@@ -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():
index 687a5a8..d311173 100644 (file)
@@ -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,