def action_update(self):
        """Form action enpoint to update the attachments
        """

        order = []
        form = self.request.form
        attachments = form.get("attachments", [])

        for attachment in attachments:
            # attachment is a form mapping, not a dictionary -> convert
            values = dict(attachment)

            uid = values.pop("UID")
            obj = api.get_object_by_uid(uid)

            # delete the attachment if the delete flag is true
            if values.pop("delete", False):
                self.delete_attachment(obj)
                continue

            # remember the order
            order.append(uid)

            # update the attachment with the given data
            obj.update(**values)
            obj.reindexObject()

        # set the attachments order to the annotation storage
        self.set_attachments_order(order)

        # redirect back to the default view
        return self.request.response.redirect(self.context.absolute_url())
def action_update ( self ) : order = [ ] form = self . request . form attachments = form . get ( "attachments" , [ ] ) for attachment in attachments : values = dict ( attachment ) uid = values . pop ( "UID" ) obj = api . get_object_by_uid ( uid ) if values . pop ( "delete" , False ) : self . delete_attachment ( obj ) continue order . append ( uid ) obj . update ( ** values ) obj . reindexObject ( ) self . set_attachments_order ( order ) return self . request . response . redirect ( self . context . absolute_url ( ) )
Form action enpoint to update the attachments