コード例 #1
0
def layer_detail(request, catalog_slug, layer_uuid=None, layer_id=None):
    if layer_uuid is not None:
        layer = get_object_or_404(Layer, uuid=layer_uuid)
    else:
        layer = get_object_or_404(Layer, pk=layer_id)

    if request.method == 'POST':
        if 'check' in request.POST:
            if settings.REGISTRY_SKIP_CELERY:
                check_layer(layer.id)
            else:
                check_layer.delay(layer.id)
        if 'remove' in request.POST:
            layer.check_set.all().delete()
        if 'index' in request.POST:
            if settings.REGISTRY_SKIP_CELERY:
                index_layer(layer.id)
            else:
                index_layer.delay(layer.id)

    return render(
        request, 'aggregator/layer_detail.html', {
            'layer': layer,
            'SEARCH_TYPE': SEARCH_TYPE,
            'SEARCH_URL': SEARCH_URL.rstrip('/'),
            'catalog_slug': catalog_slug
        })
コード例 #2
0
ファイル: views.py プロジェクト: jmwenda/hypermap
def layer_detail(request, layer_id):
    layer = get_object_or_404(Layer, pk=layer_id)
    SOLR_URL = settings.SOLR_URL

    if request.method == 'POST':
        if 'check' in request.POST:
            if not settings.SKIP_CELERY_TASK:
                check_layer.delay(layer)
            else:
                check_layer(layer)
        if 'remove' in request.POST:
            layer.check_set.all().delete()
        if 'index' in request.POST:
            if not settings.SKIP_CELERY_TASK:
                index_layer.delay(layer)
            else:
                index_layer(layer)

    return render(request, 'aggregator/layer_detail.html', {'layer': layer, 'SOLR_URL': SOLR_URL})
コード例 #3
0
ファイル: models.py プロジェクト: jmwenda/hypermap
    def check(self):
        """
        Check for availability of a layer and provide run metrics.
        """
        success = True
        start_time = datetime.datetime.utcnow()
        message = ''
        print 'Checking layer id %s' % self.id
        try:
            signals.post_save.disconnect(layer_post_save, sender=Layer)
            self.update_thumbnail()
            if settings.SOLR_ENABLED:
                if not settings.SKIP_CELERY_TASK:
                    index_layer.delay(self)
                else:
                    index_layer(self)
            signals.post_save.connect(layer_post_save, sender=Layer)

        except Exception, err:
            message = str(err)
            success = False
コード例 #4
0
    def check_available(self):
        """
        Check for availability of a layer and provide run metrics.
        """
        success = True
        start_time = datetime.datetime.utcnow()
        message = ''
        print 'Checking layer id %s' % self.id
        try:
            signals.post_save.disconnect(layer_post_save, sender=Layer)
            self.update_thumbnail()
            if settings.SEARCH_ENABLED:
                if not settings.SKIP_CELERY_TASK:
                    index_layer.delay(self)
                else:
                    index_layer(self)
            signals.post_save.connect(layer_post_save, sender=Layer)

        except Exception, err:
            message = str(err)
            success = False
コード例 #5
0
ファイル: views.py プロジェクト: jmwenda/hypermap
def layer_detail(request, layer_id):
    layer = get_object_or_404(Layer, pk=layer_id)
    SOLR_URL = settings.SOLR_URL

    if request.method == 'POST':
        if 'check' in request.POST:
            if not settings.SKIP_CELERY_TASK:
                check_layer.delay(layer)
            else:
                check_layer(layer)
        if 'remove' in request.POST:
            layer.check_set.all().delete()
        if 'index' in request.POST:
            if not settings.SKIP_CELERY_TASK:
                index_layer.delay(layer)
            else:
                index_layer(layer)

    return render(request, 'aggregator/layer_detail.html', {
        'layer': layer,
        'SOLR_URL': SOLR_URL
    })
コード例 #6
0
ファイル: views.py プロジェクト: JorgeMartinezG/HHypermap
def layer_detail(request, catalog_slug, layer_id):
    layer = get_object_or_404(Layer,
                              pk=layer_id,
                              catalog__slug=catalog_slug)

    if request.method == 'POST':
        if 'check' in request.POST:
            if settings.REGISTRY_SKIP_CELERY:
                check_layer(layer)
            else:
                check_layer.delay(layer)
        if 'remove' in request.POST:
            layer.check_set.all().delete()
        if 'index' in request.POST:
            if settings.REGISTRY_SKIP_CELERY:
                index_layer(layer)
            else:
                index_layer.delay(layer)

    return render(request, 'aggregator/layer_detail.html', {'layer': layer,
                                                            'SEARCH_TYPE': SEARCH_TYPE,
                                                            'SEARCH_URL': SEARCH_URL.rstrip('/'),
                                                            'catalog_slug': catalog_slug})