示例#1
0
    def from_json(cls, question):
        """

        :param question:
        :return:
        """
        mssp_question = cls()
        for r in question['References']:
            mssp_question.references.append(convert_subject_to_reference(r))

        for ans in question['ValidAnswers']:
            if is_yes_or_no(ans):
                mssp_question._yes_no_included = True
            else:
                if ans not in mssp_question._external_answers:
                    mssp_question._external_answers.append(ans)

        mssp_question._update_valid_answers()

        if 'SatisfiedBy' in question:
            mssp_question.satisfied_by = set(question['SatisfiedBy'])

        if 'Title' in question:
            mssp_question.title = UUID(question['Title'])

        if 'Category' in question:
            mssp_question.category = UUID(question['Category'])

        return mssp_question
示例#2
0
    def from_json(cls, target):
        from MSSP.records import Record

        # ref is sel, record
        ref = convert_subject_to_reference(target['Reference'])

        t = Record(ref[0], ref[1], [])
        return cls(t)
示例#3
0
    def from_json(cls, target):
        from MSSP.records import Record

        # ref is sel, record
        ref = convert_subject_to_reference(target['Reference'])

        t = Record(ref[0], ref[1], [])
        return cls(t)
示例#4
0
    def from_json(cls, target):
        from MSSP.records import Record

        # ref is sel, record
        ref = convert_subject_to_reference(target['Reference'])

        t = Record(ref[0], ref[1], [])

        mssp_target = cls(t)

        if 'Title' in target:
            mssp_target.title = UUID(target['Title'])

        if 'Category' in target:
            mssp_target.category = UUID(target['Category'])

        return mssp_target
示例#5
0
    def from_json(cls, question):
        """

        :param question:
        :return:
        """
        mssp_question = cls()
        for r in question['References']:
            mssp_question.references.append(convert_subject_to_reference(r))

        for ans in question['ValidAnswers']:
            if is_yes_or_no(ans):
                mssp_question._yes_no_included = True
            else:
                if ans not in mssp_question._external_answers:
                    mssp_question._external_answers.append(ans)

        mssp_question._update_valid_answers()

        if 'SatisfiedBy' in question:
            mssp_question.satisfied_by = set(question['SatisfiedBy'])

        return mssp_question