예제 #1
0
 def set_spdx_doc_uri(self, doc, spdx_doc_uri):
     """
     Sets the `spdx_document_uri` attribute of the `ExternalDocumentRef`
     object.
     """
     if validations.validate_doc_namespace(spdx_doc_uri):
         doc.ext_document_references[-1].spdx_document_uri = spdx_doc_uri
     else:
         raise SPDXValueError('Document::ExternalDocumentRef')
예제 #2
0
 def set_doc_namespace(self, doc, namespace):
     """Sets the document namespace.
     Raise SPDXValueError if malformed value, CardinalityError
     if already defined.
     """
     if not self.doc_namespace_set:
         self.doc_namespace_set = True
         if validations.validate_doc_namespace(namespace):
             doc.namespace = namespace
             return True
         else:
             raise SPDXValueError('Document::Namespace')
     else:
         raise CardinalityError('Document::Comment')