Example #1
0
def can_preview_resource_or_ingested(pkg, res):
    previewable = res.get('can_be_previewed')
    if not previewable:
        raster_resources = ext_template_helpers.get_ingested_raster(pkg, res)
        vector_resources = ext_template_helpers.get_ingested_vector(pkg, res)

        for ing_res in raster_resources:
            #for ing_res in pkg.get('resources'):
            if ing_res.get('can_be_previewed'):
                previewable = True
                break
        for ing_res in vector_resources:
            if ing_res.get('can_be_previewed'):
                previewable = True
                break
    return previewable
def can_preview_resource_or_ingested(pkg, res):
    previewable = res.get('can_be_previewed')
    if not previewable:
        raster_resources = ext_template_helpers.get_ingested_raster(pkg,res)
        vector_resources = ext_template_helpers.get_ingested_vector(pkg,res)

        for ing_res in raster_resources:
        #for ing_res in pkg.get('resources'):
            if ing_res.get('can_be_previewed'):
                previewable = True
                break
        for ing_res in vector_resources:
            if ing_res.get('can_be_previewed'):
                previewable = True
                break
    return previewable
Example #3
0
def preview_resource_or_ingested(pkg, res):
    snippet = resource_preview(res, pkg)
    data_dict = copy.copy(pkg)
    data_dict.update({'resource': res})

    if not _resource_preview(data_dict):
        raster_resources = ext_template_helpers.get_ingested_raster(pkg, res)
        vector_resources = ext_template_helpers.get_ingested_vector(pkg, res)

        for ing_res in raster_resources:
            #for ing_res in pkg.get('resources'):
            data_dict.update({'resource': ing_res})
            if _resource_preview(data_dict):
                snippet = resource_preview(ing_res, pkg)
                break
        for ing_res in vector_resources:
            data_dict.update({'resource': ing_res})
            if _resource_preview(data_dict):
                snippet = resource_preview(ing_res, pkg)
                break
    return snippet
def preview_resource_or_ingested(pkg, res):
    snippet = resource_preview(res, pkg)
    data_dict = copy.copy(pkg)
    data_dict.update({'resource':res})

    if not _resource_preview(data_dict):
        raster_resources = ext_template_helpers.get_ingested_raster(pkg,res)
        vector_resources = ext_template_helpers.get_ingested_vector(pkg,res)

        for ing_res in raster_resources:
        #for ing_res in pkg.get('resources'):
            data_dict.update({'resource':ing_res})
            if _resource_preview(data_dict):
                snippet = resource_preview(ing_res, pkg)
                break
        for ing_res in vector_resources:
            data_dict.update({'resource':ing_res})
            if _resource_preview(data_dict):
                snippet = resource_preview(ing_res, pkg)
                break
    return snippet