Compare commits

..

No commits in common. "533c70aef241b5233a40ecc1f5e5c49775f92360" and "ef83c3d25740c1ce2ce3af3b2ea39330ca4ee310" have entirely different histories.

12 changed files with 13 additions and 78 deletions

View File

@ -28,7 +28,7 @@ from os.path import basename
from typing import Tuple from typing import Tuple
from rougail.i18n import _ from rougail.i18n import _
from rougail.utils import normalize_family from rougail.utils import normalize_family, valid_variable_family_name
from rougail.error import DictConsistencyError from rougail.error import DictConsistencyError
# a object's attribute has some annotations # a object's attribute has some annotations
# that shall not be present in the exported (flatened) XML # that shall not be present in the exported (flatened) XML
@ -70,14 +70,14 @@ class Annotator:
self.objectspace.space.services.doc = 'services' self.objectspace.space.services.doc = 'services'
self.objectspace.space.services.path = 'services' self.objectspace.space.services.path = 'services'
for service_name, service in self.objectspace.space.services.service.items(): for service_name, service in self.objectspace.space.services.service.items():
service.name = normalize_family(service_name) valid_variable_family_name(service_name, service.xmlfiles)
activate_obj = self._generate_element('boolean', activate_obj = self._generate_element('boolean',
None, None,
None, None,
'activate', 'activate',
not service.disabled, not service.disabled,
service, service,
'.'.join(['services', service.name, 'activate']), '.'.join(['services', normalize_family(service_name), 'activate']),
) )
service.disabled = None service.disabled = None
for elttype, values in dict(vars(service)).items(): for elttype, values in dict(vars(service)).items():
@ -97,7 +97,7 @@ class Annotator:
eltname = elttype + 's' eltname = elttype + 's'
else: else:
eltname = elttype eltname = elttype
path = '.'.join(['services', service.name, eltname]) path = '.'.join(['services', normalize_family(service_name), eltname])
family = self._gen_family(eltname, family = self._gen_family(eltname,
path, path,
service.xmlfiles, service.xmlfiles,
@ -121,10 +121,10 @@ class Annotator:
'manage', 'manage',
service.manage, service.manage,
service, service,
'.'.join(['services', service.name, 'manage']), '.'.join(['services', normalize_family(service_name), 'manage']),
) )
service.variable = [activate_obj, manage] service.variable = [activate_obj, manage]
service.doc = service_name service.doc = service.name
def make_group_from_elts(self, def make_group_from_elts(self,
service_name, service_name,

View File

@ -320,7 +320,7 @@ class RougailBaseTemplate:
self.prepare_template(template) self.prepare_template(template)
for included in (True, False): for included in (True, False):
for service_obj in await self.config.option('services').list('all'): for service_obj in await self.config.option('services').list('all'):
service_name = await service_obj.option.description() service_name = await service_obj.option.name()
service_type = await service_obj.information.get('type', 'service') service_type = await service_obj.information.get('type', 'service')
if await service_obj.option('activate').value.get() is False: if await service_obj.option('activate').value.get() is False:
if included is False: if included is False:

View File

@ -1,14 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail version="0.10">
<services>
<service name="test-srv" engine="creole">
</service>
</services>
<variables>
<family name="general" description="général">
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
<value>oui</value>
</variable>
</family>
</variables>
</rougail>

View File

@ -1,14 +0,0 @@
{
"rougail.general.mode_conteneur_actif": {
"owner": "default",
"value": "oui"
},
"services.test_srv.activate": {
"owner": "default",
"value": true
},
"services.test_srv.manage": {
"owner": "default",
"value": true
}
}

View File

@ -1,5 +0,0 @@
{
"rougail.general.mode_conteneur_actif": "oui",
"services.test_srv.activate": true,
"services.test_srv.manage": true
}

View File

@ -1,14 +0,0 @@
{
"rougail.general.mode_conteneur_actif": {
"owner": "default",
"value": "oui"
},
"services.test_srv.activate": {
"owner": "default",
"value": true
},
"services.test_srv.manage": {
"owner": "default",
"value": true
}
}

View File

@ -1,22 +0,0 @@
from importlib.machinery import SourceFileLoader
from importlib.util import spec_from_loader, module_from_spec
loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
spec = spec_from_loader(loader.name, loader)
func = module_from_spec(spec)
loader.exec_module(func)
for key, value in dict(locals()).items():
if key != ['SourceFileLoader', 'func']:
setattr(func, key, value)
try:
from tiramisu3 import *
except:
from tiramisu import *
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"}))
option_2 = OptionDescription(name="general", doc="général", children=[option_3], properties=frozenset({"normal"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
option_6 = BoolOption(name="activate", doc="activate", default=True)
option_7 = BoolOption(name="manage", doc="manage", default=True)
option_5 = OptionDescription(name="test_srv", doc="test-srv", children=[option_6, option_7])
option_5.impl_set_information('engine', "creole")
option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"}))
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4])

View File

@ -1 +0,0 @@
%%mode_conteneur_actif

View File

@ -0,0 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail version="0.10">
<services>
<service name="testsrv.mount"/>
</services>
</rougail>