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