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

Method save

vulnerabilities/models.py:3727–3750  ·  view source on GitHub ↗

Save, normalizing PURL fields.

(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

3725 return self.package_url
3726
3727 def save(self, *args, **kwargs):
3728 """
3729 Save, normalizing PURL fields.
3730 """
3731 purl = PackageURL(
3732 type=self.type,
3733 namespace=self.namespace,
3734 name=self.name,
3735 version=self.version,
3736 qualifiers=self.qualifiers,
3737 subpath=self.subpath,
3738 )
3739
3740 # We re-parse the purl to ensure name and namespace
3741 # are set correctly
3742 normalized = normalize_purl(purl=purl)
3743
3744 for name, value in purl_to_dict(normalized).items():
3745 setattr(self, name, value)
3746
3747 self.package_url = str(normalized)
3748 plain_purl = utils.plain_purl(normalized)
3749 self.plain_package_url = str(plain_purl)
3750 super().save(*args, **kwargs)
3751
3752 objects = PackageQuerySetV2.as_manager()
3753

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