Пример #1
0
 def patch(self):
     """Asset Item Update"""
     if apply_patch(self.request, src=self.request.context.serialize()):
         update_file_content_type(self.request)
         self.LOGGER.info('Updated asset item {}'.format(self.request.context.id),
                     extra=context_unpack(self.request, {'MESSAGE_ID': 'asset_item_patch'}))
         return {'data': self.request.context.serialize("view")}
Пример #2
0
 def patch(self):
     """Asset Decision Update"""
     if apply_patch(self.request, src=self.request.context.serialize()):
         self.LOGGER.info(
             'Updated asset decision {}'.format(self.request.context.id),
             extra=context_unpack(self.request,
                                  {'MESSAGE_ID': 'asset_decision_patch'}))
         return {'data': self.request.context.serialize("view")}
Пример #3
0
 def collection_post(self):
     """Asset Item Upload"""
     item = self.request.validated['item']
     self.context.items.append(item)
     if save_asset(self.request):
         self.LOGGER.info('Created asset item {}'.format(item.id),
                     extra=context_unpack(self.request, {'MESSAGE_ID': 'asset_item_create'}, {'item_id': item.id}))
         self.request.response.status = 201
         item_route = self.request.matched_route.name.replace("collection_", "")
         self.request.response.headers['Location'] = self.request.current_route_url(_route_name=item_route, item_id=item.id, _query={})
         return {'data': item.serialize("view")}
Пример #4
0
 def collection_post(self):
     """Asset Decision Upload"""
     decision = self.request.validated['decision']
     self.context.decisions.append(decision)
     if save_asset(self.request):
         self.LOGGER.info(
             'Created asset decision {}'.format(decision.id),
             extra=context_unpack(self.request,
                                  {'MESSAGE_ID': 'asset_decision_create'},
                                  {'decision_id': decision.id}))
         self.request.response.status = 201
         decision_route = self.request.matched_route.name.replace(
             "collection_", "")
         self.request.response.headers[
             'Location'] = self.request.current_route_url(
                 _route_name=decision_route,
                 decision_id=decision.id,
                 _query={})
         return {'data': decision.serialize("view")}