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:
@@ -133,14 +133,14 @@ def domain_factory(domainname, domainlabel, todolist, grammar):
|
|||||||
return ".".join(path[1:])
|
return ".".join(path[1:])
|
||||||
|
|
||||||
def format_paths(self, paths):
|
def format_paths(self, paths):
|
||||||
zone_types = []
|
zone_types = set()
|
||||||
nozone_paths = []
|
nozone_paths = []
|
||||||
for path in paths:
|
for path in paths:
|
||||||
try:
|
try:
|
||||||
zone_idx = path.index("zone")
|
zone_idx = path.index("zone")
|
||||||
zone_type_txt = path[zone_idx + 1]
|
zone_type_txt = path[zone_idx + 1]
|
||||||
assert zone_type_txt.startswith("type "), zone_type_txt
|
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):
|
except (ValueError, IndexError):
|
||||||
nozone_paths.append(path)
|
nozone_paths.append(path)
|
||||||
condensed_paths = nozone_paths[:]
|
condensed_paths = nozone_paths[:]
|
||||||
|
|||||||
@@ -46,6 +46,10 @@ def combine():
|
|||||||
assert rest
|
assert rest
|
||||||
rest.update(zones)
|
rest.update(zones)
|
||||||
|
|
||||||
|
# this is a terrible hack
|
||||||
|
# but cfg_test cannot print zone grammars inside view
|
||||||
|
rest["view"]["_mapbody"].update(zones)
|
||||||
|
|
||||||
return rest
|
return rest
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user