Save, normalizing PURL fields.
(self, *args, **kwargs)
| 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 |
nothing calls this directly
no test coverage detected