From eab13c50d1ce122ee0b0a07171047f7a76cc5318 Mon Sep 17 00:00:00 2001 From: Mark Carroll Date: Mon, 18 Apr 2016 14:55:21 +0100 Subject: [PATCH] adjust web to delete ns-anns via their links only --- .../webclient/controller/container.py | 22 +------------------ .../omeroweb/webclient/webclient_gateway.py | 2 +- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/components/tools/OmeroWeb/omeroweb/webclient/controller/container.py b/components/tools/OmeroWeb/omeroweb/webclient/controller/container.py index 6fea1e1e1dc..74caf8b18e2 100644 --- a/components/tools/OmeroWeb/omeroweb/webclient/controller/container.py +++ b/components/tools/OmeroWeb/omeroweb/webclient/controller/container.py @@ -28,7 +28,6 @@ from django.conf import settings from django.utils.encoding import smart_str import logging -from omero.cmd import Delete2 from webclient.controller import BaseController @@ -1238,29 +1237,10 @@ def remove(self, parents, index, tag_owner_id=None): self.conn.deleteObject(al._obj) elif self.comment: # remove the comment from specified parent + # the comment is automatically deleted when orphaned for al in self.comment.getParentLinks(dtype, [parentId]): if al is not None and al.canDelete(): self.conn.deleteObject(al._obj) - # if comment is orphan, delete it directly - orphan = True - - # Use delete Dry Run... - cid = self.comment.getId() - command = Delete2(targetObjects={"CommentAnnotation": [cid]}, - dryRun=True) - cb = self.conn.c.submit(command) - # ...to check for any remaining links - rsp = cb.getResponse() - cb.close(True) - for parentType in ["Project", "Dataset", "Image", "Screen", - "Plate", "PlateAcquisition", "Well"]: - key = 'ome.model.annotations.%sAnnotationLink' % parentType - if key in rsp.deletedObjects: - orphan = False - break - if orphan: - self.conn.deleteObject(self.comment._obj) - elif self.dataset is not None: if dtype == 'project': for pdl in self.dataset.getParentLinks([parentId]): diff --git a/components/tools/OmeroWeb/omeroweb/webclient/webclient_gateway.py b/components/tools/OmeroWeb/omeroweb/webclient/webclient_gateway.py index 950300d28ca..3c89814ec72 100644 --- a/components/tools/OmeroWeb/omeroweb/webclient/webclient_gateway.py +++ b/components/tools/OmeroWeb/omeroweb/webclient/webclient_gateway.py @@ -2145,7 +2145,7 @@ def addRating(value): ratingAnn.save() else: self._conn.deleteObject(ratingLink._obj) - self._conn.deleteObject(ratingAnn._obj) + # ratingAnn was automatically deleted if orphaned # otherwise, unlink and create a new rating else: self._conn.deleteObject(ratingLink._obj)