Ejemplo n.º 1
0
    def get(self, tip_token, *uriargs):
        """
        Parameters: None
        Response: actorsReceiverList
        Errors: InvalidTipAuthToken
        """

        try:
            if is_receiver_token(tip_token):

                requested_t = ReceiverTip()
                tip_description = yield requested_t.admin_get_single(tip_token)

            else:

                requested_t = WhistleblowerTip()
                tip_description = yield requested_t.admin_get_single(tip_token)

            itip_iface = InternalTip()

            inforet = yield itip_iface.get_receivers_map(tip_description['internaltip_id'])

            self.write(json.dumps(inforet))
            self.set_status(200)

        except TipGusNotFound, e:

            self.set_status(e.http_status)
            self.write({'error_message' : e.error_message, 'error_code' : e.error_code})
Ejemplo n.º 2
0
    def post(self, tip_token, *uriargs):
        """
        Request: actorsCommentDesc
        Response: actorsCommentDesc
        Errors: InvalidTipAuthToken, InvalidInputFormat, TipGusNotFound, TipReceiptNotFound
        """

        comment_iface = Comment()

        try:
            request = validateMessage(self.request.body, requests.actorsCommentDesc)

            if is_receiver_token(tip_token):

                requested_t = ReceiverTip()

                tip_description = yield requested_t.admin_get_single(tip_token)
                comment_stored = yield comment_iface.add_comment(tip_description['internaltip_id'],
                    request['content'], u"receiver", tip_description['receiver_gus'])

            else:
                requested_t = WhistleblowerTip()

                tip_description = yield requested_t.admin_get_single(tip_token)
                comment_stored = yield comment_iface.add_comment(tip_description['internaltip_id'],
                    request['content'], u"whistleblower")

            # TODO: internaltip <> last_usage_time_update()
            self.set_status(200)
            self.write(json.dumps(comment_stored))

        except TipGusNotFound, e:

            self.set_status(e.http_status)
            self.write({'error_message' : e.error_message, 'error_code' : e.error_code})