Skip to content

Commit 543c748

Browse files
jdcaballerovmgautierfr
authored andcommitted
Remove check metadata check from finalize
1 parent 34fd489 commit 543c748

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

libzim/libzim.pyx

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,9 @@ cdef class ZimCreator:
182182
cdef object _index_language
183183
cdef object _min_chunk_size
184184
cdef object _article_counter
185-
cdef object _metadata
185+
cdef dict __dict__
186186

187-
def __init__(self, str filename, str main_page = "", str index_language = "eng", min_chunk_size = 2048):
187+
def __cinit__(self, str filename, str main_page = "", str index_language = "eng", min_chunk_size = 2048):
188188
"""Constructs a ZimCreator from parameters.
189189
Parameters
190190
----------
@@ -251,7 +251,6 @@ cdef class ZimCreator:
251251

252252
return metadata
253253

254-
@property
255254
def mandatory_metadata_ok(self):
256255
"""Flag if mandatory metadata is complete and not empty"""
257256
metadata_item_ok = [self._metadata[k] for k in MANDATORY_METADATA_KEYS]
@@ -312,14 +311,11 @@ cdef class ZimCreator:
312311
Runtime Error
313312
If mandatory metadata is missing
314313
"""
315-
if not self._finalized:
316-
if not self.mandatory_metadata_ok:
317-
raise RuntimeError("Mandatory metadata missing")
318-
319-
self.c_creator.finalize()
320-
self._finalized = True
321-
else:
314+
if self._finalized:
322315
raise RuntimeError("ZimCreator already finalized")
316+
317+
self.c_creator.finalize()
318+
self._finalized = True
323319

324320
def __repr__(self):
325321
return f"{self.__class__.__name__}(filename={self.filename})"

0 commit comments

Comments
 (0)