コード例 #1
0
ファイル: models.py プロジェクト: fispace/wirecloud
    def delete(self, *args, **kwargs):

        from wirecloud.catalogue.utils import wgt_deployer

        # Delete the related wiring information for that resource
        WidgetWiring.objects.filter(idResource=self.id).delete()

        # Delete the related tags for that resource
        UserTag.objects.filter(idResource=self.id).delete()

        # Delete the related votes for that resource
        UserVote.objects.filter(idResource=self.id).delete()

        if hasattr(self, 'widget'):
            from wirecloud.platform.models import Widget
            try:
                self.widget.delete()
            except Widget.DoesNotExist:
                pass

        # Delete media resources if needed
        if not self.template_uri.startswith(('http', 'https')):
            wgt_deployer.undeploy(self.vendor, self.short_name, self.version)

        super(CatalogueResource, self).delete(*args, **kwargs)
コード例 #2
0
    def delete(self, *args, **kwargs):

        from wirecloud.catalogue.utils import wgt_deployer

        old_id = self.id
        super(CatalogueResource, self).delete(*args, **kwargs)

        # Preserve the id attribute a bit more so CatalogueResource methods can use it
        self.id = old_id

        # Undeploy the resource from the filesystem
        try:
            wgt_deployer.undeploy(self.vendor, self.short_name, self.version)
        except:
            # TODO log this error
            pass  # ignore errors

        # Remove cache for this resource
        self.invalidate_cache()

        # Remove document from search indexes
        try:
            with get_search_engine('resource').get_batch_writer() as writer:
                writer.delete_by_term('pk', '%s' % old_id)
        except:
            pass  # ignore errors

        # Remove id attribute definetly
        self.id = None
コード例 #3
0
ファイル: models.py プロジェクト: aarranz/wirecloud
    def delete(self, *args, **kwargs):

        from wirecloud.catalogue.utils import wgt_deployer

        # Delete the related wiring information for that resource
        WidgetWiring.objects.filter(idResource=self.id).delete()

        if hasattr(self, 'widget'):
            from wirecloud.platform.models import Widget
            try:
                self.widget.delete()
            except Widget.DoesNotExist:
                pass

        # Delete media resources if needed
        if not self.template_uri.startswith(('http', 'https')):
            wgt_deployer.undeploy(self.vendor, self.short_name, self.version)

        old_id = self.id
        super(CatalogueResource, self).delete(*args, **kwargs)

        # Remove cache for this resource
        try:
            cache.incr('_catalogue_resource_version/' + str(old_id))
        except ValueError:
            pass
コード例 #4
0
ファイル: models.py プロジェクト: Mognom/wirecloud
    def delete(self, *args, **kwargs):

        from wirecloud.catalogue.utils import wgt_deployer

        old_id = self.id
        super(CatalogueResource, self).delete(*args, **kwargs)

        # Preserve the id attribute a bit more so CatalogueResource methods can use it
        self.id = old_id

        # Undeploy the resource from the filesystem
        try:
            wgt_deployer.undeploy(self.vendor, self.short_name, self.version)
        except:
            # TODO log this error
            pass  # ignore errors

        # Remove cache for this resource
        self.invalidate_cache()

        # Remove document from search indexes
        try:
            with get_search_engine('resource').get_batch_writer() as writer:
                writer.delete_by_term('pk', '%s' % old_id)
        except:
            pass  # ignore errors

        # Remove id attribute definetly
        self.id = None
コード例 #5
0
ファイル: handlers.py プロジェクト: ngpJason/wirecloud
def delete_file_on_resource_deletion(sender, instance, **kwargs):
    # Undeploy the resource from the filesystem
    try:
        wgt_deployer.undeploy(instance.vendor, instance.short_name, instance.version)
    except Exception:
        # TODO log this error
        pass  # ignore errors

    instance.invalidate_cache()
コード例 #6
0
ファイル: models.py プロジェクト: Wirecloud/wirecloud
    def delete(self, *args, **kwargs):

        from wirecloud.catalogue.utils import wgt_deployer

        old_id = self.id
        super(CatalogueResource, self).delete(*args, **kwargs)

        # Preserve the id attribute a bit more so CatalogueResource methods can use it
        self.id = old_id

        # Undeploy the resource from the filesystem
        try:
            wgt_deployer.undeploy(self.vendor, self.short_name, self.version)
        except:
            # TODO log this error
            pass  # ignore errors

        # Remove cache for this resource
        self.invalidate_cache()

        # Remove id attribute definetly
        self.id = None
コード例 #7
0
ファイル: models.py プロジェクト: yasuhi526/wirecloud
    def delete(self, *args, **kwargs):

        from wirecloud.catalogue.utils import wgt_deployer

        old_id = self.id
        super(CatalogueResource, self).delete(*args, **kwargs)

        # Preserve the id attribute a bit more so CatalogueResource methods can use it
        self.id = old_id

        # Undeploy the resource from the filesystem
        try:
            wgt_deployer.undeploy(self.vendor, self.short_name, self.version)
        except:
            # TODO log this error
            pass  # ignore errors

        # Remove cache for this resource
        self.invalidate_cache()

        # Remove id attribute definetly
        self.id = None