コード例 #1
0
ファイル: refuse.py プロジェクト: 4teamwork/opengever.core
    def store_copy_in_remote_yearfolder(self, refusing_unit_id):
        transporter = Transporter()
        jsondata = json.dumps(transporter.extract(self.context))
        request_data = {REQUEST_KEY: jsondata, }

        response = dispatch_json_request(
            refusing_unit_id, '@@store_refused_forwarding',
            data=request_data)

        if response.get('status') not in [
                STATUS_SUCCESSFULL, STATUS_ALLREADY_DONE]:
            raise Exception(
                'Storing the forwarding on remote yearfolder failed')

        remote_task = response.get('remote_task')
        if response.get('status') != STATUS_ALLREADY_DONE:
            # transport responses
            response_transporter = IResponseTransporter(self.context)
            response_transporter.send_responses(
                refusing_unit_id, remote_task)

            # transport documents
            for document in get_documents_of_task(self.context):
                transporter.transport_to(
                    document, refusing_unit_id, remote_task)

        return self.get_remote_task_url(refusing_unit_id, remote_task)
コード例 #2
0
    def store_copy_in_remote_yearfolder(self, refusing_client_id):
        transporter = getUtility(ITransporter)
        jsondata = json.dumps(transporter._extract_data(self.context))
        request_data = {
            REQUEST_KEY: jsondata,
        }

        response = remote_json_request(refusing_client_id,
                                       '@@store_refused_forwarding',
                                       data=request_data)

        if response.get('status') not in [
                STATUS_SUCCESSFULL, STATUS_ALLREADY_DONE
        ]:
            raise Exception(
                'Storing the forwarding on remote yearfolder failed')

        remote_task = response.get('remote_task')
        if response.get('status') != STATUS_ALLREADY_DONE:
            # transport responses
            response_transporter = IResponseTransporter(self.context)
            response_transporter.send_responses(refusing_client_id,
                                                remote_task)

            # transport documents
            for document in get_documents_of_task(self.context):
                transporter.transport_to(document, refusing_client_id,
                                         remote_task)

        return self.get_remote_task_url(refusing_client_id, remote_task)