Ejemplo n.º 1
0
 def patch(self):
     agreement = self.context
     apply_patch(self.request, save=False, src=self.request.validated["agreement_src"])
     if save_agreement(self.request):
         self.LOGGER.info(
             "Updated agreement {}".format(agreement.id),
             extra=context_unpack(self.request, {"MESSAGE_ID": "agreement_patch"}),
         )
         return {"data": agreement.serialize("view")}
Ejemplo n.º 2
0
    def patch(self):
        agreement = self.request.validated["agreement"]

        access = set_ownership(agreement, self.request)
        if save_agreement(self.request):
            self.LOGGER.info(
                "Generate Agreement credentials {}".format(agreement.id),
                extra=context_unpack(self.request, {"MESSAGE_ID": "agreement_patch"}),
            )
            return {"data": agreement.serialize("view"), "access": access}
Ejemplo n.º 3
0
 def patch(self):
     """ Agreement Document Update """
     if apply_patch(self.request, src=self.request.context.serialize()):
         update_file_content_type(self.request)
         self.LOGGER.info(
             "Updated agreement document {}".format(
                 self.request.context.id),
             extra=context_unpack(
                 self.request, {"MESSAGE_ID": "agreement_document_patch"}),
         )
         return {"data": self.request.context.serialize("view")}
Ejemplo n.º 4
0
    def put(self):
        """ Agreement Document Update"""
        document = upload_file(self.request)
        self.request.validated["agreement"].documents.append(document)

        if save_agreement(self.request):
            self.LOGGER.info(
                "Updated agreement document {}".format(
                    self.request.context.id),
                extra=context_unpack(self.request,
                                     {"MESSAGE_ID": "agreement_document_put"}),
            )
            return {"data": document.serialize("view")}
Ejemplo n.º 5
0
 def collection_post(self):
     """ Agreement Document Upload"""
     document = upload_file(self.request)
     self.context.documents.append(document)
     if save_agreement(self.request):
         self.LOGGER.info(
             "Created agreement document {}".format(document.id),
             extra=context_unpack(
                 self.request, {"MESSAGE_ID": "agreement_document_create"},
                 {"document_id": document.id}),
         )
         self.request.response.status = 201
         document_route = self.request.matched_route.name.replace(
             "collection_", "")
         self.request.response.headers[
             "Location"] = self.request.current_route_url(
                 _route_name=document_route,
                 document_id=document.id,
                 _query={})
         return {"data": document.serialize("view")}