Skip to content

Commit

Permalink
Merge pull request #435 from cgalibern/b2.1
Browse files Browse the repository at this point in the history
Allow foo.1bar has valid rfc952 rule
  • Loading branch information
cgalibern committed Aug 2, 2021
2 parents b9d8852 + e987964 commit 83f729c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
8 changes: 6 additions & 2 deletions opensvc/tests/test_utilities.py
Expand Up @@ -558,9 +558,13 @@ class TestValidateName:
('1.foo.bar', None),
('123.FOO.bar', None),
# other valid names
('f', None),
('f.b', None),
('f', ex.Error),
('f.b', ex.Error),
('foo.bar', None),
('foo.1bar', None),
('foo.-bar', None),
('foo.----bar', None),
('foo.123----bar', None),
('foo.bar123', None),
('foo.bar1', None),
('foo1.bar1', None),
Expand Down
5 changes: 2 additions & 3 deletions opensvc/utilities/naming/__init__.py
Expand Up @@ -12,11 +12,10 @@
from core.contexts import want_context
from env import Env


# RFC952 + RFC1123 validation rule
VALID_NAME_RFC952_NO_DOT = (r"^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9-]*[a-zA-Z0-9]))*"
r"([A-Za-z]|[A-Za-z][A-Za-z0-9-]*[A-Za-z0-9])$")
VALID_NAME_RFC952 = (r"^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9-]*[a-zA-Z0-9])\.)*"
r"([A-Za-z]|[A-Za-z][A-Za-z0-9-]*[A-Za-z0-9])$")
VALID_NAME_RFC952 = r"^[a-zA-Z]([a-zA-Z0-9-]+[.]?)*[a-zA-Z0-9]$"

ANSI_ESCAPE = re.compile(r"\x1b\[([0-9]{1,3}(;[0-9]{1,3})*)?[mHJKG]", re.UNICODE)
ANSI_ESCAPE_B = re.compile(br"\x1b\[([0-9]{1,3}(;[0-9]{1,3})*)?[mHJKG]")
Expand Down

0 comments on commit 83f729c

Please sign in to comment.