allow filename with \
This commit is contained in:
parent
3ad1bf0604
commit
7db3e2c2a9
@ -10,7 +10,7 @@ import logging
|
||||
from typing import Dict, Any
|
||||
from subprocess import call
|
||||
from os import listdir, makedirs
|
||||
from os.path import dirname, join, isfile
|
||||
from os.path import dirname, join, isfile, abspath, normpath
|
||||
|
||||
from Cheetah.Template import Template as ChtTemplate
|
||||
from Cheetah.NameMapper import NotFound as CheetahNotFound
|
||||
@ -92,6 +92,21 @@ class CheetahTemplate(ChtTemplate):
|
||||
file=filename,
|
||||
searchList=[context, eosfunc, extra_context])
|
||||
|
||||
# FORK of Cheetah fonction, do not replace '\\' by '/'
|
||||
def serverSidePath(self, path=None,
|
||||
normpath=normpath,
|
||||
abspath=abspath
|
||||
):
|
||||
|
||||
if path:
|
||||
return normpath(abspath(path))
|
||||
# return normpath(abspath(path.replace("\\", '/')))
|
||||
elif hasattr(self, '_filePath') and self._filePath:
|
||||
return normpath(abspath(self._filePath))
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
|
||||
class CreoleLeader:
|
||||
def __init__(self, value, follower=None, index=None):
|
||||
|
20
tests/dictionaries/01base_file_utfchar/00-base.xml
Normal file
20
tests/dictionaries/01base_file_utfchar/00-base.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<rougail>
|
||||
|
||||
<services>
|
||||
<service name="test">
|
||||
<file name="/etc/systemd-makefs@dev-disk-by\\x2dpartlabel"/>
|
||||
</service>
|
||||
</services>
|
||||
|
||||
<variables>
|
||||
<family name="general">
|
||||
<variable name="mode_conteneur_actif" type="oui/non" description="Description">
|
||||
<value>non</value>
|
||||
</variable>
|
||||
</family>
|
||||
<separators/>
|
||||
</variables>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
0
tests/dictionaries/01base_file_utfchar/__init__.py
Normal file
0
tests/dictionaries/01base_file_utfchar/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
{"rougail.general.mode_conteneur_actif": "non", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.group": "root", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.mode": "0644", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.name": "/etc/systemd-makefs@dev-disk-by\\x2dpartlabel", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.owner": "root", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.source": "systemd-makefs@dev-disk-by\\x2dpartlabel", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.templating": true, "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.activate": true}
|
@ -0,0 +1 @@
|
||||
non
|
26
tests/dictionaries/01base_file_utfchar/tiramisu/base.py
Normal file
26
tests/dictionaries/01base_file_utfchar/tiramisu/base.py
Normal file
@ -0,0 +1,26 @@
|
||||
import imp
|
||||
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
|
||||
for key, value in dict(locals()).items():
|
||||
if key != ['imp', 'func']:
|
||||
setattr(func, key, value)
|
||||
try:
|
||||
from tiramisu3 import *
|
||||
except:
|
||||
from tiramisu import *
|
||||
from rougail.tiramisu import ConvertDynOptionDescription
|
||||
option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='Description', multi=False, default='non', values=('oui', 'non'))
|
||||
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3])
|
||||
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
|
||||
option_8 = StrOption(name='group', doc='group', multi=False, default='root')
|
||||
option_9 = StrOption(name='mode', doc='mode', multi=False, default='0644')
|
||||
option_10 = StrOption(name='name', doc='name', multi=False, default='/etc/systemd-makefs@dev-disk-by\\x2dpartlabel')
|
||||
option_11 = StrOption(name='owner', doc='owner', multi=False, default='root')
|
||||
option_12 = StrOption(name='source', doc='source', multi=False, default='systemd-makefs@dev-disk-by\\x2dpartlabel')
|
||||
option_13 = BoolOption(name='templating', doc='templating', multi=False, default=True)
|
||||
option_14 = BoolOption(name='activate', doc='activate', multi=False, default=True)
|
||||
option_7 = OptionDescription(name='systemd_makefs@dev_disk_by\\x2dpartlabel', doc='systemd-makefs@dev-disk-by\\x2dpartlabel', children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14])
|
||||
option_6 = OptionDescription(name='files', doc='files', children=[option_7])
|
||||
option_5 = OptionDescription(name='test', doc='test', children=[option_6])
|
||||
option_5.impl_set_information("manage", True)
|
||||
option_4 = OptionDescription(name='services', doc='services', properties=frozenset({'hidden'}), children=[option_5])
|
||||
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1, option_4])
|
@ -0,0 +1 @@
|
||||
%%mode_conteneur_actif
|
@ -1,2 +1 @@
|
||||
{"rougail.proxy_authentifie.toto1": null, "rougail.proxy_authentifie.toto2": "3127"}
|
||||
|
||||
|
@ -1,2 +1 @@
|
||||
{"rougail.proxy_authentifie.toto1": null, "rougail.proxy_authentifie.toto2": "3127"}
|
||||
|
||||
|
@ -17,6 +17,8 @@ for test in listdir(dico_dirs):
|
||||
if isdir(join(dico_dirs, test, 'tiramisu')):
|
||||
test_ok.add(test)
|
||||
|
||||
debug = False
|
||||
#debug = True
|
||||
excludes = set([])
|
||||
#excludes = set(['70container_services'])
|
||||
test_ok -= excludes
|
||||
@ -33,8 +35,6 @@ def test_dir(request):
|
||||
|
||||
|
||||
async def launch_flattener(test_dir):
|
||||
debug = False
|
||||
#debug = True
|
||||
makedict_dir = join(test_dir, 'makedict')
|
||||
makedict_file = join(makedict_dir, 'base.json')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user