def put(self):
     parent = self.request.context.__parent__
     document = upload_file(self.request)
     set_author(document, self.request, 'author')
     parent.documents.append(document)
     if save_inspection(self.request):
         self.LOGGER.info('Updated inspection document {}'.format(document.id),
                          extra=context_unpack(self.request,
                                               {'MESSAGE_ID': 'inspection_document_put'},
                                               {'DOCUMENT_ID': document.id}))
         return {'data': document.serialize("view")}
 def collection_post(self):
     document = upload_file(self.request)
     set_author(document, self.request, 'author')
     documents = self.context.documents
     documents.append(document)
     if save_inspection(self.request):
         self.LOGGER.info('Created inspection document {}'.format(document.id),
                          extra=context_unpack(self.request,
                                               {'MESSAGE_ID': 'inspection_document_create'},
                                               {'DOCUMENT_ID': document.id}))
         route = self.request.matched_route.name.replace("collection_", "")
         location = self.request.current_route_url(document_id=document.id, _route_name=route, _query={})
         self.request.response.status = 201
         self.request.response.headers['Location'] = location
         return {'data': document.serialize("view")}
 def put(self):
     parent = self.request.context.__parent__
     document = upload_file(self.request)
     set_author(document, self.request, "author")
     parent.documents.append(document)
     if save_request(self.request):
         self.LOGGER.info(
             "Updated request document {}".format(document.id),
             extra=context_unpack(
                 self.request,
                 {"MESSAGE_ID": "request_document_put"},
                 {"DOCUMENT_ID": document.id},
             ),
         )
         return {"data": document.serialize("view")}
Beispiel #4
0
 def put(self):
     """
     Monitoring Document Update
     """
     parent = self.request.context.__parent__
     document = upload_file(self.request)
     set_author(document, self.request, 'author')
     parent.documents.append(document)
     if save_monitoring(self.request):
         self.LOGGER.info(
             'Updated {} monitoring document {}'.format(
                 self.document_type, document.id),
             extra=context_unpack(self.request,
                                  {'MESSAGE_ID': 'monitoring_document_put'},
                                  {'DOCUMENT_ID': document.id}))
         return {'data': document.serialize('view')}
 def collection_post(self):
     document = upload_file(self.request)
     set_author(document, self.request, "author")
     documents = self.context.documents
     documents.append(document)
     if save_request(self.request):
         self.LOGGER.info(
             "Created request document {}".format(document.id),
             extra=context_unpack(
                 self.request,
                 {"MESSAGE_ID": "request_document_create"},
                 {"DOCUMENT_ID": document.id},
             ),
         )
         route = self.request.matched_route.name.replace("collection_", "")
         location = self.request.current_route_url(
             document_id=document.id, _route_name=route, _query={}
         )
         self.request.response.status = 201
         self.request.response.headers["Location"] = location
         return {"data": document.serialize("view")}
Beispiel #6
0
 def collection_post(self):
     """
     Monitoring Document Upload
     """
     document = upload_file(self.request)
     set_author(document, self.request, 'author')
     documents = self.context.documents
     documents.append(document)
     if save_monitoring(self.request):
         self.LOGGER.info('Created {} monitoring document {}'.format(
             self.document_type, document.id),
                          extra=context_unpack(
                              self.request,
                              {'MESSAGE_ID': 'monitoring_document_create'},
                              {'DOCUMENT_ID': document.id}))
         route = self.request.matched_route.name.replace('collection_', '')
         location = self.request.current_route_url(document_id=document.id,
                                                   _route_name=route,
                                                   _query={})
         self.request.response.status = 201
         self.request.response.headers['Location'] = location
         return {'data': document.serialize('view')}