def ajax_delete_analysis_attachment(self):
        """Endpoint for attachment delete in WS
        """
        form = self.request.form
        attachment_uid = form.get("attachment_uid", None)

        if not attachment_uid:
            return "error"

        attachment = api.get_object_by_uid(attachment_uid, None)
        if attachment is None:
            return "Could not resolve attachment UID {}".format(attachment_uid)

        # handle delete via the AttachmentsView
        view = self.context.restrictedTraverse("@@attachments_view")
        view.delete_attachment(attachment)

        return "success"
def ajax_delete_analysis_attachment ( self ) : form = self . request . form attachment_uid = form . get ( "attachment_uid" , None ) if not attachment_uid : return "error" attachment = api . get_object_by_uid ( attachment_uid , None ) if attachment is None : return "Could not resolve attachment UID {}" . format ( attachment_uid ) view = self . context . restrictedTraverse ( "@@attachments_view" ) view . delete_attachment ( attachment ) return "success"
Endpoint for attachment delete in WS