Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Lu Xu
slapos
Commits
391d4570
Commit
391d4570
authored
Dec 27, 2023
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
dfe79c77
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
6 deletions
+17
-6
software/ors-amarisoft/ru/xbuildout.py
software/ors-amarisoft/ru/xbuildout.py
+17
-6
No files found.
software/ors-amarisoft/ru/xbuildout.py
View file @
391d4570
...
...
@@ -24,6 +24,17 @@
# encode converts string s into form suitable to be used in names of buildout sections.
#
# Such encoding is needed because buildout forbids to use spaces and many other
# characters in section names, which, in turn, leads to inability to use
# arbitrary strings for sections generated based on e.g. instance references
# retrieved from SlapOS Master.
#
# With encoding it becomes possible to use arbitrary names for references
# without leading to instantiation failures like
#
# zc.buildout.configparser.ParsingError: File contains parsing errors: .../instance-enb.cfg
# [line 45]: '[promise-testing partition 0.RU-sdr-busy]\n'
#
# The encoding never fails, does not loose information and can be reversed back via decode.
def
encode
(
s
:
str
):
# -> str
s
=
s
.
encode
(
'utf-8'
)
...
...
@@ -114,13 +125,13 @@ def test_encode():
# also explicitly test several example cases, including unicode
testv
=
[
# s encoded
(
''
,
''
),
(
'a'
,
'a'
),
(
''
,
''
),
(
'a'
,
'a'
),
(
'ayzAYZ09.-'
,
'ayzAYZ09.-'
),
(
'_'
,
'__'
),
(
' '
,
'_20'
),
(
'αβγ'
,
'_ce_b1_ce_b2_ce_b3'
),
(
'a b+c_d'
,
'a_20b_2bc__d'
),
(
'_'
,
'__'
),
(
' '
,
'_20'
),
(
'αβγ'
,
'_ce_b1_ce_b2_ce_b3'
),
(
'a b+c_d'
,
'a_20b_2bc__d'
),
]
for
(
s
,
encok
)
in
testv
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment