def create_qualification(self):
        submission = self.request.context
        framework = self.request.validated["framework"]

        qualification_id = generate_id()
        qualification_data = {
            "id": qualification_id,
            "frameworkID": framework["_id"],
            "submissionID": submission.id,
            "framework_owner": framework["owner"],
            "framework_token": framework["owner_token"],
            "qualificationType": framework["frameworkType"],
            "mode": framework.get("type")
        }
        qualification = Qualification(qualification_data)
        self.request.validated["qualification_src"] = {}
        self.request.validated["qualification"] = qualification

        if save_qualification(self.request):
            submission.qualificationID = qualification_id
            self.LOGGER.info(
                "Created qualification {}".format(qualification_id),
                extra=context_unpack(
                    self.request,
                    {"MESSAGE_ID": "qualification_create"},
                    {"qualification_id": qualification_id,
                     "qualification_mode": qualification.mode},
                ),
            )
Beispiel #2
0
 def save(self, request, **kwargs):
     return save_qualification(request)