Skip to content

Commit

Permalink
Add Capture for provenance summary
Browse files Browse the repository at this point in the history
  • Loading branch information
bensteinberg committed Jan 8, 2025
1 parent 14146a1 commit c2615cb
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions perma_web/perma/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1989,13 +1989,25 @@ def write_uploaded_file(self, uploaded_file, cache_break=False):
r = random.SystemRandom()
warc_url += f"?version={str(r.random()).replace('.', '')}"

capture = Capture(link=self,
role='primary',
status='success',
record_type='resource',
user_upload='True',
content_type=mime_type,
url=warc_url)
upload_capture = Capture(
link=self,
role='primary',
status='success',
record_type='resource',
user_upload='True',
content_type=mime_type,
url=warc_url
)

provenance_capture = Capture(
link=self,
role='provenance_summary',
status='success',
record_type='resource',
user_upload='True',
content_type='text/html',
url='file:///provenance-summary.html'
)

# make the WACZ
self.wacz_size = preserve_perma_wacz(
Expand All @@ -2013,7 +2025,8 @@ def write_uploaded_file(self, uploaded_file, cache_break=False):
self.captured_by_software = 'upload'
self.captured_by_browser = None
self.save(update_fields=['captured_by_software', 'captured_by_browser', 'warc_size', 'wacz_size'])
capture.save()
upload_capture.save()
provenance_capture.save()

def safe_delete_warc(self):
old_name = self.warc_storage_file()
Expand Down

0 comments on commit c2615cb

Please sign in to comment.