From 41620cc92ee62749e7fa4613d80e9c29b3782f6c Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Fri, 19 Feb 2021 11:03:52 +0100 Subject: [PATCH] add manage service --- src/rougail/annotator/service.py | 4 +++- src/rougail/data/rougail.dtd | 1 + .../70service_not_managed/00-base.xml | 12 ++++++++++++ .../70service_not_managed/__init__.py | 0 .../70service_not_managed/makedict/base.json | 1 + .../70service_not_managed/tiramisu/base.py | 19 +++++++++++++++++++ 6 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 tests/dictionaries/70service_not_managed/00-base.xml create mode 100644 tests/dictionaries/70service_not_managed/__init__.py create mode 100644 tests/dictionaries/70service_not_managed/makedict/base.json create mode 100644 tests/dictionaries/70service_not_managed/tiramisu/base.py diff --git a/src/rougail/annotator/service.py b/src/rougail/annotator/service.py index 920b01dfa..c3f09654c 100644 --- a/src/rougail/annotator/service.py +++ b/src/rougail/annotator/service.py @@ -65,7 +65,9 @@ class ServiceAnnotator: self.objectspace.space.services.doc = 'services' self.objectspace.space.services.path = 'services' for service_name, service in self.objectspace.space.services.service.items(): - service.information = self.objectspace.information(service.xmlfiles) + if not service.manage: + service.information = self.objectspace.information(service.xmlfiles) + service.information.manage = service.manage for elttype, values in dict(vars(service)).items(): if not isinstance(values, (dict, list)) or elttype in ERASED_ATTRIBUTES: continue diff --git a/src/rougail/data/rougail.dtd b/src/rougail/data/rougail.dtd index 2a050556e..c7e3f0a5e 100644 --- a/src/rougail/data/rougail.dtd +++ b/src/rougail/data/rougail.dtd @@ -48,6 +48,7 @@ + diff --git a/tests/dictionaries/70service_not_managed/00-base.xml b/tests/dictionaries/70service_not_managed/00-base.xml new file mode 100644 index 000000000..f07a0700f --- /dev/null +++ b/tests/dictionaries/70service_not_managed/00-base.xml @@ -0,0 +1,12 @@ + + + + + + + + + mailname + + + diff --git a/tests/dictionaries/70service_not_managed/__init__.py b/tests/dictionaries/70service_not_managed/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/dictionaries/70service_not_managed/makedict/base.json b/tests/dictionaries/70service_not_managed/makedict/base.json new file mode 100644 index 000000000..678b36e6d --- /dev/null +++ b/tests/dictionaries/70service_not_managed/makedict/base.json @@ -0,0 +1 @@ +{"rougail.var": "mailname"} diff --git a/tests/dictionaries/70service_not_managed/tiramisu/base.py b/tests/dictionaries/70service_not_managed/tiramisu/base.py new file mode 100644 index 000000000..4de4409bf --- /dev/null +++ b/tests/dictionaries/70service_not_managed/tiramisu/base.py @@ -0,0 +1,19 @@ +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_2 = StrOption(name="var", doc="var", default="mailname", properties=frozenset({"mandatory", "normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_4 = OptionDescription(name="test", doc="test", children=[]) +option_4.impl_set_information('manage', False) +option_3 = OptionDescription(name="services", doc="services", children=[option_4], properties=frozenset({"hidden"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_3])