Skip to content

Commit

Permalink
remove metadata conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
aryanA101a committed Apr 1, 2024
1 parent 0562ffd commit f708d34
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 8 deletions.
2 changes: 0 additions & 2 deletions libzim/libzim.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -576,8 +576,6 @@ class Creator(_Creator):
self, name: str, content: Union[str, bytes, datetime.date, datetime.datetime],
mimetype: str = "text/plain;charset=UTF-8"
):
if name == "Date" and isinstance(content, (datetime.date, datetime.datetime)):
content = content.strftime("%Y-%m-%d").encode("UTF-8")
if isinstance(content, str):
content = content.encode("UTF-8")
super().add_metadata(name=name, content=content, mimetype=mimetype)
Expand Down
6 changes: 0 additions & 6 deletions tests/test_libzim_creator.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env python

import base64
import datetime
import itertools
import os
import pathlib
Expand Down Expand Up @@ -400,13 +399,8 @@ def test_creator_metadata(fpath, lipsum_item):
with Creator(fpath) as c:
c.add_item(lipsum_item)
for name, value in metadata.items():
if name == "Date":
continue
c.add_metadata(name, value)

mdate = datetime.date(*[int(x) for x in metadata.get("Date").split("-")])
c.add_metadata("Date", mdate)

zim = Archive(fpath)
for name, value in metadata.items():
assert zim.get_metadata(name).decode("UTF-8") == value
Expand Down

0 comments on commit f708d34

Please sign in to comment.