summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-05-13 18:24:00 -0700
committerBryan Newbold <bnewbold@robocracy.org>2019-05-13 18:24:00 -0700
commitdb451c8c1733c8a209aa9144ffdf7bf8de57c1f1 (patch)
tree25d978d040ad350755a9631f60364967e1069eab
parentb6c6465091a6f5484782fe8c90690d147b4e2296 (diff)
downloadfatcat-db451c8c1733c8a209aa9144ffdf7bf8de57c1f1.tar.gz
fatcat-db451c8c1733c8a209aa9144ffdf7bf8de57c1f1.zip
python: impl size_bytes -> size
-rwxr-xr-xpython/fatcat_tools/importers/wayback_static.py2
-rw-r--r--python/fatcat_web/templates/webcapture_view.html2
-rw-r--r--python/tests/api_webcaptures.py10
3 files changed, 7 insertions, 7 deletions
diff --git a/python/fatcat_tools/importers/wayback_static.py b/python/fatcat_tools/importers/wayback_static.py
index c4f4f21e..b4b1111e 100755
--- a/python/fatcat_tools/importers/wayback_static.py
+++ b/python/fatcat_tools/importers/wayback_static.py
@@ -120,7 +120,7 @@ def lookup_cdx(embed_url, verify_hashes=True, cdx_output=None):
resp.raise_for_status()
assert webcapture_cdx.sha1 == hashlib.sha1(resp.content).digest().hex()
webcapture_cdx.sha256 = hashlib.sha256(resp.content).digest().hex()
- webcapture_cdx.size_bytes = len(resp.content)
+ webcapture_cdx.size = len(resp.content)
return webcapture_cdx
else:
return None
diff --git a/python/fatcat_web/templates/webcapture_view.html b/python/fatcat_web/templates/webcapture_view.html
index 7593dd3f..9020bf63 100644
--- a/python/fatcat_web/templates/webcapture_view.html
+++ b/python/fatcat_web/templates/webcapture_view.html
@@ -54,7 +54,7 @@ No known public archive for this webcapture.
<div style="margin-left: 1em;">
{{ row.timestamp.strftime("%Y-%m-%d %H:%M:%S") }}
{% if row.mimetype %}| {{ row.mimetype }} {% endif %}
- {% if row.size_bytes %}| {{ row.size_bytes|filesizeformat }} {% endif %}
+ {% if row.size %}| {{ row.size|filesizeformat }} {% endif %}
<br>
<code><small style="color: #666;">
{% if row.sha1 %}sha1:{{ row.sha1 }}<br>{% endif %}
diff --git a/python/tests/api_webcaptures.py b/python/tests/api_webcaptures.py
index e5c516d1..8c685b30 100644
--- a/python/tests/api_webcaptures.py
+++ b/python/tests/api_webcaptures.py
@@ -27,7 +27,7 @@ def test_webcapture(api):
url="http://example.site/data/thing.tar.gz",
mimetype="application/gzip",
status_code=200,
- size_bytes=1234,
+ size=1234,
sha1="455face3598611458efe1f072e58624790a67266",
sha256="c7b49f3e84cd1b7cb0b0e3e9f632b7be7e21b4dc229df23331f880a8a7dfa75a",
),
@@ -38,7 +38,7 @@ def test_webcapture(api):
url="http://example.site/README.md",
mimetype="text/markdown",
status_code=200,
- size_bytes=4321,
+ size=4321,
sha1="455face3598611458efe1f072e58624790a67266",
sha256="429bcafa4d3d0072d5b2511e12c85c1aac1d304011d1c406da14707f7b9cd905",
),
@@ -67,7 +67,7 @@ def test_webcapture(api):
assert wc1.archive_urls[0].rel == wc2.archive_urls[0].rel
assert wc1.archive_urls[0].url == wc2.archive_urls[0].url
assert wc1.cdx[0] == wc2.cdx[0]
- assert wc1.cdx[0].size_bytes == wc2.cdx[0].size_bytes
+ assert wc1.cdx[0].size == wc2.cdx[0].size
assert wc1.cdx == wc2.cdx
assert wc1.release_ids == wc2.release_ids
assert wc1.timestamp == wc2.timestamp
@@ -121,7 +121,7 @@ def test_bad_webcapture(api):
surt="site,example,)/123.jpg",
url="http://example.site/123.jpg",
sha1="455face3598611458efe1f072e58624790a67266",
- size_bytes=123,
+ size=123,
timestamp="20120102030405")]),
# CDX timestamp format (int)
WebcaptureEntity(
@@ -140,7 +140,7 @@ def test_bad_webcapture(api):
surt="site,example,)/123.jpg",
url="http://example.site/123.jpg",
sha1="455face3598611458efe1f072e58624790a67266",
- size_bytes=-123,
+ size=-123,
timestamp="20120102030405")]),
]