Permalink
Browse files

Better protection against corrupted internal data in ``_index_parents``.

svn path=/Products.ExtendedPathIndex/trunk/; revision=40267
  • Loading branch information...
1 parent 39cd18a commit 9f60579e77c8dd90ffe9bab462c98022eaec56dc @hannosch hannosch committed Sep 26, 2010
Showing with 8 additions and 4 deletions.
  1. +3 −0 CHANGES.txt
  2. +5 −4 Products/ExtendedPathIndex/ExtendedPathIndex.py
View
@@ -4,6 +4,9 @@ Changelog
3.0a1 - unreleased
------------------
+* Better protection against corrupted internal data in ``_index_parents``.
+ [hannosch]
+
* Slightly optimize reindexing an object by passing in information from the
index to the unindex method and avoiding another unindex scan.
[hannosch]
@@ -162,10 +162,11 @@ def unindex(comp, level, docid=docid):
# Remove full-path indexes
parent_path = '/' + '/'.join(comps[:-1])
- parents = self._index_parents[parent_path]
- parents.remove(docid)
- if not parents:
- del self._index_parents[parent_path]
+ parents = self._index_parents.get(parent_path, _marker)
+ if parents is not _marker:
+ parents.remove(docid)
+ if not parents:
+ del self._index_parents[parent_path]
del self._index_items['/'.join([parent_path, comps[-1]])]
except KeyError:
logger.log(logging.INFO,

0 comments on commit 9f60579

Please sign in to comment.