Merge branch 'master' of ssh://git.labs.libre-entreprise.org/gitroot/tiramisu
[tiramisu.git] / tiramisu / option.py
index d46c8c9..b9960b6 100644 (file)
@@ -978,6 +978,10 @@ class DomainnameOption(Option):
         end = ''
         extrachar = ''
         extrachar_mandatory = ''
+        if self._type != 'netbios':
+            allow_number = '\d'
+        else:
+            allow_number = ''
         if self._type == 'netbios':
             length = 14
         elif self._type == 'hostname':
@@ -989,8 +993,9 @@ class DomainnameOption(Option):
             else:
                 extrachar = '\.'
             end = '+[a-z]*'
-        self._domain_re = re.compile(r'^(?:[a-z][a-z\d\-{0}]{{,{1}}}{2}){3}$'
-                                     ''.format(extrachar, length, extrachar_mandatory, end))
+        self._domain_re = re.compile(r'^(?:[a-z{0}][a-z\d\-{1}]{{,{2}}}{3}){4}$'
+                                     ''.format(allow_number, extrachar, length,
+                                               extrachar_mandatory, end))
         super(DomainnameOption, self).__init__(name, doc, default=default,
                                                default_multi=default_multi,
                                                callback=callback,