allow any character as service name

This commit is contained in:
2021-05-14 07:00:55 +02:00
parent 9c1589ca53
commit 4711206c55
12 changed files with 78 additions and 13 deletions

View File

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

View File

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