Closed rgaudin closed 4 years ago
That's why the wrapper should do the less :)
We can simply remove the getSize implementation and ask user to implement it (potentially without getting the data itself).
Or we move the implementation in the python world that would allow the user to overwrite it we implementing a article using get_filename
.
My preference is for the first option but it introduces a API break.
I don't think breaking the API is too much trouble at this stage but having to implement get_size seems like an additional burden while 90% of the use cases are probably either getting the size of get_data or doing an fstat of the filename. But it's not terrible neither so I'd be OK with it.
libzim allows the creation of article from a file using
getFilename()
which is replicated here inget_filename()
.This is not directly usable here as
getSize()
assumes that user is implementinggetData()
(get_data()
here) which renders the getFilename mode useless.https://github.com/openzim/python-libzim/blob/488c6499a6fd9497308c9b0b1ccf8a663a02b2f0/libzim/lib.cxx#L177-L181