コード例 #1
0
ファイル: spec.py プロジェクト: faegi/mapproxy
def validate_mapproxy_conf(conf_dict):
    """
    Validate `conf_dict` agains mapproxy.yaml spec.
    Returns lists with errors. List is empty when no errors where found.
    """
    try:
        validate(mapproxy_yaml_spec, conf_dict)
    except ValidationError as ex:
        return ex.errors, ex.informal_only
    else:
        return [], True

coverage = {
    '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(),
}
image_opts = {
    'mode': str(),
    'colors': number(),
    'transparent': bool(),
    'resampling_method': str(),
    'format': str(),
    'encoding_options': {
コード例 #2
0
ファイル: spec.py プロジェクト: vartagg/mapproxy
def validate_mapproxy_conf(conf_dict):
    """
    Validate `conf_dict` agains mapproxy.yaml spec.
    Returns lists with errors. List is empty when no errors where found.
    """
    try:
        validate(mapproxy_yaml_spec, conf_dict)
    except ValidationError as ex:
        return ex.errors, ex.informal_only
    else:
        return [], True

coverage = {
    '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(),
}
image_opts = {
    'mode': str(),
    'colors': number(),
    'transparent': bool(),
    'resampling_method': str(),
    'format': str(),
    'encoding_options': {
コード例 #3
0
ファイル: spec.py プロジェクト: drnextgis/mapproxy
def validate_seed_conf(conf_dict):
    """
    Validate `conf_dict` agains seed.yaml spec.
    Returns lists with errors. List is empty when no errors where found.
    """
    try:
        validate(seed_yaml_spec, conf_dict)
    except ValidationError as ex:
        return ex.errors, ex.informal_only
    else:
        return [], True


from_to_spec = {
    'from': number(),
    'to': number(),
}

seed_yaml_spec = {
    'coverages': {
        anything(): coverage,
    },
    'seeds': {
        anything(): {
            required('caches'): [str()],
            'grids': [str()],
            'coverages': [str()],
            'refresh_before': time_spec,
            'levels': one_off([int()], from_to_spec),
            'resolutions': one_off([int()], from_to_spec),
コード例 #4
0
ファイル: spec.py プロジェクト: GeoDodo/mapproxy
from mapproxy.config.spec import coverage

def validate_seed_conf(conf_dict):
    """
    Validate `conf_dict` agains seed.yaml spec.
    Returns lists with errors. List is empty when no errors where found.
    """
    try:
        validate(seed_yaml_spec, conf_dict)
    except ValidationError as ex:
        return ex.errors, ex.informal_only
    else:
        return [], True

time_spec = {
    'seconds': number(),
    'minutes': number(),
    'hours': number(),
    'days': number(),
    'weeks': number(),
    'time': anything(),
    'mtime': str(),
}

from_to_spec = {
    'from': number(),
    'to': number(),
}

seed_yaml_spec = {
    'coverages': {
コード例 #5
0
ファイル: spec.py プロジェクト: imclab/mapproxy
def validate_seed_conf(conf_dict):
    """
    Validate `conf_dict` agains seed.yaml spec.
    Returns lists with errors. List is empty when no errors where found.
    """
    try:
        validate(seed_yaml_spec, conf_dict)
    except ValidationError, ex:
        return ex.errors, ex.informal_only
    else:
        return [], True


time_spec = {
    'seconds': number(),
    'minutes': number(),
    'hours': number(),
    'days': number(),
    'weeks': number(),
    'time': anything(),
    'mtime': str(),
}

from_to_spec = {
    'from': number(),
    'to': number(),
}

seed_yaml_spec = {
    'coverages': {