Skip to content

Commit e6afe75

Browse files
mgautierfrrgaudin
authored andcommitted
fixup! Add wrapper around add_alias
1 parent 8bbca3d commit e6afe75

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

libzim/libzim.pyx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -395,8 +395,8 @@ cdef class _Creator:
395395
with nogil:
396396
self.c_creator.addRedirection(_path, _title, _targetPath, _hints)
397397

398-
def add_clone(self, str path: str, str title: str, str targetPath: str, dict hints: Dict[Hint, pyint]):
399-
"""Clone the (existing) entry `targetPath` into a new entry `path`.
398+
def add_alias(self, str path: str, str title: str, str targetPath: str, dict hints: Dict[Hint, pyint]):
399+
"""Alias the (existing) entry `targetPath` as a new entry `path`.
400400
401401
Raises
402402
------
@@ -411,7 +411,7 @@ cdef class _Creator:
411411
cdef string _targetPath = targetPath.encode('UTF-8')
412412
cdef map[zim.HintKeys, uint64_t] _hints = convertToCppHints(hints)
413413
with nogil:
414-
self.c_creator.addClone(_path, _title, _targetPath, _hints)
414+
self.c_creator.addAlias(_path, _title, _targetPath, _hints)
415415

416416
def __enter__(self):
417417
cdef string _path = str(self._filename).encode('UTF-8')

libzim/zim.pxd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ cdef extern from "zim/writer/creator.h" namespace "zim::writer":
7070
void addItem(shared_ptr[WriterItem] item) nogil except +
7171
void addMetadata(string name, string content, string mimetype) nogil except +
7272
void addRedirection(string path, string title, string targetpath, map[HintKeys, uint64_t] hints) nogil except +
73-
void addClone(string path, string title, string targetpath, map[HintKeys, uint64_t] hints) nogil except +
73+
void addAlias(string path, string title, string targetpath, map[HintKeys, uint64_t] hints) except + nogil
7474
void finishZimCreation() nogil except +
7575
void setMainPath(string mainPath)
7676
void addIllustration(unsigned int size, string content) nogil except +

tests/test_libzim_creator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,9 +476,9 @@ def test_creator_clone(fpath, lipsum_item):
476476

477477
with Creator(fpath) as c:
478478
c.add_item(lipsum_item)
479-
c.add_clone("home", "hello", HOME_PATH, {Hint.FRONT_ARTICLE: True})
479+
c.add_alias("home", "hello", HOME_PATH, {Hint.FRONT_ARTICLE: True})
480480
with pytest.raises(RuntimeError, match="doesn't exist"):
481-
c.add_clone("accueil", "bonjour", HOME_PATH+"_no_existitant", {Hint.FRONT_ARTICLE: True})
481+
c.add_alias("accueil", "bonjour", HOME_PATH+"_no_existitant", {Hint.FRONT_ARTICLE: True})
482482

483483
zim = Archive(fpath)
484484
assert zim.entry_count == 2

0 commit comments

Comments
 (0)