MCPcopy Create free account
hub / github.com/aboutcode-org/vulnerablecode / save

Method save

vulnerabilities/models.py:930–953  ·  view source on GitHub ↗

Save, normalizing PURL fields.

(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

928 return self.package_url
929
930 def save(self, *args, **kwargs):
931 """
932 Save, normalizing PURL fields.
933 """
934 purl = PackageURL(
935 type=self.type,
936 namespace=self.namespace,
937 name=self.name,
938 version=self.version,
939 qualifiers=self.qualifiers,
940 subpath=self.subpath,
941 )
942
943 # We re-parse the purl to ensure name and namespace
944 # are set correctly
945 normalized = normalize_purl(purl=purl)
946
947 for name, value in purl_to_dict(normalized).items():
948 setattr(self, name, value)
949
950 self.package_url = str(normalized)
951 plain_purl = utils.plain_purl(normalized)
952 self.plain_package_url = str(plain_purl)
953 super().save(*args, **kwargs)
954
955 @property
956 def calculate_version_rank(self):

Callers

nothing calls this directly

Calls 3

normalize_purlFunction · 0.90
purl_to_dictFunction · 0.90
saveMethod · 0.45

Tested by

no test coverage detected