Skip to content

Commit

Permalink
Do not break when reindexing multiple indexes (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Howitz committed Dec 6, 2019
1 parent 54ba3d8 commit 4a9ccec
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 3 additions & 1 deletion CHANGES.rst
Expand Up @@ -4,7 +4,9 @@ Changelog
5.1 (unreleased)
----------------

- Nothing changed yet.
- Fix exception happening when reindexing multiple indexes while having a
progress handler.
(`#89 <https://github.com/zopefoundation/Products.ZCatalog/pull/89>`_)


5.0.1 (2019-06-17)
Expand Down
10 changes: 5 additions & 5 deletions src/Products/ZCatalog/ZCatalog.py
Expand Up @@ -410,14 +410,14 @@ def manage_clearIndex(self, ids=None,

@security.protected(manage_zcatalog_entries)
def reindexIndex(self, name, REQUEST, pghandler=None):
if isinstance(name, str):
name = (name, )

# This method does the actual reindexing of indexes.
# `name` can be the name of an index of a list of names.
idxs = (name, ) if isinstance(name, str) else name
paths = self._catalog.uids.keys()

i = 0
if pghandler:
pghandler.init('reindexing %s' % name, len(paths))
pghandler.init('reindexing {}'.format(idxs), len(paths))

for p in paths:
i += 1
Expand All @@ -433,7 +433,7 @@ def reindexIndex(self, name, REQUEST, pghandler=None):
else:
# don't update metadata when only reindexing a single
# index via the UI
self.catalog_object(obj, p, idxs=name,
self.catalog_object(obj, p, idxs=idxs,
update_metadata=0, pghandler=pghandler)

if pghandler:
Expand Down

0 comments on commit 4a9ccec

Please sign in to comment.