def post(self):
     """
     Creating new submission
     """
     submission_id = generate_id()
     submission = self.request.validated["submission"]
     submission.id = submission_id
     framework = self.request.validated["framework"]
     submission.submissionType = framework["frameworkType"]
     submission.mode = framework.get("mode")
     if self.request.json["data"].get("status") == "draft":
         submission.status = "draft"
     access = set_ownership(submission, self.request)
     self.request.validated["submission"] = submission
     self.request.validated["submission_src"] = {}
     if save_submission(self.request):
         self.LOGGER.info(
             "Created submission {}".format(submission_id),
             extra=context_unpack(
                 self.request,
                 {"MESSAGE_ID": "submission_create"},
                 {
                     "submission_id": submission_id,
                     "submission_mode": submission.mode
                 },
             ),
         )
         self.request.response.status = 201
         self.request.response.headers["Location"] = self.request.route_url(
             "{}:Submission".format(submission.submissionType),
             submission_id=submission_id)
         return {"data": submission.serialize("view"), "access": access}
Example #2
0
 def save(self, request, **kwargs):
     return save_submission(request)