Add zone definitions into the view grammar

I cannot see a reasonable way to achieve this without the hack in this
commit.
This commit is contained in:
Petr Špaček
2022-06-24 14:06:39 +02:00
parent 1f5bc4fe3b
commit 435cbb61ba
2 changed files with 6 additions and 2 deletions

View File

@@ -133,14 +133,14 @@ def domain_factory(domainname, domainlabel, todolist, grammar):
return ".".join(path[1:])
def format_paths(self, paths):
zone_types = []
zone_types = set()
nozone_paths = []
for path in paths:
try:
zone_idx = path.index("zone")
zone_type_txt = path[zone_idx + 1]
assert zone_type_txt.startswith("type "), zone_type_txt
zone_types.append(zone_type_txt[len("type ") :])
zone_types.add(zone_type_txt[len("type ") :])
except (ValueError, IndexError):
nozone_paths.append(path)
condensed_paths = nozone_paths[:]

View File

@@ -46,6 +46,10 @@ def combine():
assert rest
rest.update(zones)
# this is a terrible hack
# but cfg_test cannot print zone grammars inside view
rest["view"]["_mapbody"].update(zones)
return rest