- Revision
- 16027
- Author
- vajda
- Date
- 2007-12-03 13:30:05 -0800 (Mon, 03 Dec 2007)
Log Message
- patch for bug 11174
(http://bugzilla.osafoundation.org/show_bug.cgi?id=11174)
(rebuilding indexes after locale change)
(http://bugzilla.osafoundation.org/show_bug.cgi?id=11174)
(rebuilding indexes after locale change)
Modified Paths
Diff
Modified: trunk/chandler/repository/item/Indexed.py (16026 => 16027)
--- trunk/chandler/repository/item/Indexed.py 2007-12-03 21:28:30 UTC (rev 16026) +++ trunk/chandler/repository/item/Indexed.py 2007-12-03 21:30:05 UTC (rev 16027) @@ -239,6 +239,27 @@ self._indexes[indexName] = index return index + def rebuildIndex(self, name, subIndexes=True): + """ + Rebuild an index on this collection. + + If the constraints on an index change without the index noticing, as + for example, when a locale change causes a sorted index to go out of + order, this method allows the index to be rebuilt. It iterates the + entire collection, avoiding existing indexes and rebuilds the named + index anew. By default, sub-indexes of the index are rebuilt as well. + + @param name: the name of the index to be rebuilt + @param subIndexes: rebuild sub-indexes of the index as well, C{True} + by default + @return: the new index object + """ + + item, attrName = self.itsOwner + index = self.getIndex(name) + + return self._rebuildIndex(None, index, item, attrName, name, subIndexes) + def setRanges(self, indexName, ranges): self.getIndex(indexName).setRanges(ranges) @@ -743,9 +764,10 @@ def _rebuildIndex(self, logger, index, item, attribute, name, subIndexes=True): - - logger.warning("Rebuilding index '%s' installed on value '%s' of type %s in attribute '%s' on %s", name, self, type(self), attribute, item._repr_()) + if logger is not None: + logger.warning("Rebuilding index '%s' installed on value '%s' of type %s in attribute '%s' on %s", name, self, type(self), attribute, item._repr_()) + view = item.itsView kwds = index.getInitKeywords() if 'ranges' in kwds:
_______________________________________________ Commits mailing list [email protected] http://lists.osafoundation.org/mailman/listinfo/commits
