MCPcopy Index your code
hub / github.com/ArchiveBox/ArchiveBox / size

Method size

archivebox/core/admin.py:193–205  ·  view source on GitHub ↗
(self, obj)

Source from the content-addressed store, hash-verified

191 files.short_description = 'Files Saved'
192
193 def size(self, obj):
194 archive_size = (Path(obj.link_dir) / 'index.html').exists() and obj.archive_size
195 if archive_size:
196 size_txt = printable_filesize(archive_size)
197 if archive_size > 52428800:
198 size_txt = mark_safe(f'<b>{size_txt}</b>')
199 else:
200 size_txt = mark_safe('<span style="opacity: 0.3">...</span>')
201 return format_html(
202 '<a href="/{}" title="View all files">{}</a>',
203 obj.archive_path,
204 size_txt,
205 )
206
207 size.admin_order_field = 'archiveresult__count'
208

Callers 1

infoMethod · 0.95

Calls 1

printable_filesizeFunction · 0.90

Tested by

no test coverage detected