'layers': one_of( { anything(): combined(scale_hints, { 'sources': [string_type], required('title'): string_type, 'legendurl': str(), 'md': wms_130_layer_md, }) }, recursive([combined(scale_hints, { 'sources': [string_type], 'name': str(), required('title'): string_type, 'legendurl': str(), 'layers': recursive(), 'md': wms_130_layer_md, 'dimensions': { anything(): { required('values'): [one_of(string_type, float, int)], 'default': one_of(string_type, float, int), } } })]) ), # `parts` can be used for partial configurations that are referenced # from other sections (e.g. coverages, dimensions, etc.) 'parts': anything(), } if __name__ == '__main__': import sys import yaml
validate(mapproxy_yaml_spec, conf_dict) except ValidationError as ex: return ex.errors, ex.informal_only else: return [], True coverage = recursive({ 'polygons': str(), 'polygons_srs': str(), 'bbox': one_of(str(), [number()]), 'bbox_srs': str(), 'ogr_datasource': str(), 'ogr_where': str(), 'ogr_srs': str(), 'datasource': one_of(str(), [number()]), 'where': str(), 'srs': str(), 'expire_tiles': str(), 'union': [recursive()], 'difference': [recursive()], 'intersection': [recursive()], 'clip': bool(), }) image_opts = { 'mode': str(), 'colors': number(), 'transparent': bool(), 'resampling_method': str(), 'format': str(),
'sources': [string_type], required('title'): string_type, 'legendurl': str(), 'md': wms_130_layer_md, }) }, recursive([ combined( scale_hints, { 'sources': [string_type], 'tile_sources': [string_type], 'name': str(), required('title'): string_type, 'legendurl': str(), 'layers': recursive(), 'md': wms_130_layer_md, 'dimensions': { anything(): { required('values'): [one_of(string_type, float, int)], 'default': one_of(string_type, float, int), } } }) ])), # `parts` can be used for partial configurations that are referenced # from other sections (e.g. coverages, dimensions, etc.) 'parts': anything(), }
try: validate(mapproxy_yaml_spec, conf_dict) except ValidationError as ex: return ex.errors, ex.informal_only else: return [], True coverage = recursive({ 'polygons': str(), 'polygons_srs': str(), 'bbox': one_of(str(), [number()]), 'bbox_srs': str(), 'ogr_datasource': str(), 'ogr_where': str(), 'ogr_srs': str(), 'datasource': one_of(str(), [number()]), 'where': str(), 'srs': str(), 'expire_tiles': str(), 'union': [recursive()], 'difference': [recursive()], 'intersection': [recursive()], 'clip': bool(), }) image_opts = { 'mode': str(), 'colors': number(), 'transparent': bool(), 'resampling_method': str(), 'format': str(),
}) }, 'layers': one_of( { anything(): combined(scale_hints, { 'sources': [str()], required('title'): basestring, 'legendurl': str(), 'md': wms_130_layer_md, }) }, recursive([combined(scale_hints, { 'sources': [str()], 'name': str(), required('title'): basestring, 'legendurl': str(), 'layers': recursive(), 'md': wms_130_layer_md, })]) ), } if __name__ == '__main__': import sys import yaml for f in sys.argv[1:]: data = yaml.load(open(f)) try: validate(mapproxy_yaml_spec, data) except ValidationError, ex: for err in ex.errors:
{ anything(): combined( scale_hints, { 'sources': [str()], required('title'): basestring, 'legendurl': str(), 'md': wms_130_layer_md, }) }, recursive([ combined( scale_hints, { 'sources': [str()], 'name': str(), required('title'): basestring, 'legendurl': str(), 'layers': recursive(), 'md': wms_130_layer_md, }) ])), } if __name__ == '__main__': import sys import yaml for f in sys.argv[1:]: data = yaml.load(open(f)) try: validate(mapproxy_yaml_spec, data) except ValidationError, ex: