def parse_raster_layer_if_status_is_unparsed(sender, instance, created, **kwargs): from raster.tasks import parse RasterLayerMetadata.objects.get_or_create(rasterlayer=instance) status, created = RasterLayerParseStatus.objects.get_or_create( rasterlayer=instance) if (instance.rasterfile.name or instance.source_url) and status.status == status.UNPARSED: parse(instance.id)
def parse_raster_layer_if_status_is_unparsed(sender, instance, created, **kwargs): from raster.tasks import parse RasterLayerMetadata.objects.get_or_create(rasterlayer=instance) status, created = RasterLayerParseStatus.objects.get_or_create(rasterlayer=instance) if (instance.rasterfile.name or instance.source_url) and status.status == status.UNPARSED: parse(instance.id)
def test_no_raterfile(self): layer = RasterLayer.objects.create(name='No max zoom', build_pyramid=False) msg = 'No data source found. Provide a rasterfile or a source url.' with self.assertRaisesMessage(RasterException, msg): parse(layer)