def put(self):
     """Plan Document Update"""
     document = upload_file(self.request)
     self.request.validated["plan"].documents.append(document)
     if save_plan(self.request):
         self.LOGGER.info(
             "Updated plan document {}".format(self.request.context.id),
             extra=context_unpack(self.request, {"MESSAGE_ID": "plan_document_put"}),
         )
         return {"data": document.serialize("view")}
 def collection_post(self):
     """Plan Document Upload"""
     document = upload_file(self.request)
     self.context.documents.append(document)
     if save_plan(self.request):
         self.LOGGER.info(
             "Created plan document {}".format(document.id),
             extra=context_unpack(
                 self.request, {"MESSAGE_ID": "plan_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")}