[Zope-Checkins] SVN: Zope/branches/2.12/ Enhanced the internals of the DateRangeIndex based on an idea from experimental.daterangeindexoptimisations, thanks to Matt Hamilton.
Hanno Schlichting
hannosch at hannosch.eu
Sat Dec 19 13:48:45 EST 2009
Log message for revision 106786:
Enhanced the internals of the DateRangeIndex based on an idea from experimental.daterangeindexoptimisations, thanks to Matt Hamilton.
Changed:
U Zope/branches/2.12/doc/CHANGES.rst
U Zope/branches/2.12/src/Products/PluginIndexes/DateRangeIndex/DateRangeIndex.py
-=-
Modified: Zope/branches/2.12/doc/CHANGES.rst
===================================================================
--- Zope/branches/2.12/doc/CHANGES.rst 2009-12-19 18:28:56 UTC (rev 106785)
+++ Zope/branches/2.12/doc/CHANGES.rst 2009-12-19 18:48:45 UTC (rev 106786)
@@ -24,6 +24,9 @@
- zope.session = 3.9.2
- zope.tal = 3.5.2
+- Enhanced the internals of the DateRangeIndex based on an idea from
+ experimental.daterangeindexoptimisations, thanks to Matt Hamilton.
+
- Updated the default value for ``management_page_charset`` from iso-8859-1
to the nowadays more standard utf-8.
Modified: Zope/branches/2.12/src/Products/PluginIndexes/DateRangeIndex/DateRangeIndex.py
===================================================================
--- Zope/branches/2.12/src/Products/PluginIndexes/DateRangeIndex/DateRangeIndex.py 2009-12-19 18:28:56 UTC (rev 106785)
+++ Zope/branches/2.12/src/Products/PluginIndexes/DateRangeIndex/DateRangeIndex.py 2009-12-19 18:48:45 UTC (rev 106786)
@@ -316,27 +316,42 @@
set = self._until_only.get( until, None )
if set is None:
- set = self._until_only[ until ] = IISet() # XXX: Store an int?
- set.insert( documentId )
-
+ self._until_only[ until ] = documentId
+ else:
+ if isinstance(set, int):
+ set = self._until_only[ until ] = IISet((set, documentId))
+ else:
+ set.insert( documentId )
elif until is None:
set = self._since_only.get( since, None )
if set is None:
- set = self._since_only[ since ] = IISet() # XXX: Store an int?
- set.insert( documentId )
+ self._since_only[ since ] = documentId
+ else:
+ if isinstance(set, int):
+ set = self._since_only[ since ] = IISet((set, documentId))
+ else:
+ set.insert( documentId )
else:
set = self._since.get( since, None )
if set is None:
- set = self._since[ since ] = IISet() # XXX: Store an int?
- set.insert( documentId )
+ self._since[ since ] = documentId
+ else:
+ if isinstance(set, int):
+ set = self._since[ since ] = IISet((set, documentId))
+ else:
+ set.insert( documentId )
set = self._until.get( until, None )
if set is None:
- set = self._until[ until ] = IISet() # XXX: Store an int?
- set.insert( documentId )
+ self._until[ until ] = documentId
+ else:
+ if isinstance(set, int):
+ set = self._until[ until ] = IISet((set, documentId))
+ else:
+ set.insert( documentId )
def _removeForwardIndexEntry( self, since, until, documentId ):
"""
@@ -352,37 +367,51 @@
set = self._until_only.get( until, None )
if set is not None:
- set.remove( documentId )
+ if isinstance(set, int):
+ del self._until_only[until]
+ else:
+ set.remove( documentId )
- if not set:
- del self._until_only[ until ]
+ if not set:
+ del self._until_only[ until ]
elif until is None:
set = self._since_only.get( since, None )
if set is not None:
- set.remove( documentId )
-
- if not set:
+ if isinstance(set, int):
del self._since_only[ since ]
+ else:
+ set.remove( documentId )
+ if not set:
+ del self._since_only[ since ]
+
else:
set = self._since.get( since, None )
if set is not None:
- set.remove( documentId )
- if not set:
+ if isinstance(set, int):
del self._since[ since ]
+ else:
+ set.remove( documentId )
+ if not set:
+ del self._since[ since ]
+
set = self._until.get( until, None )
if set is not None:
- set.remove( documentId )
- if not set:
+ if isinstance(set, int):
del self._until[ until ]
+ else:
+ set.remove( documentId )
+ if not set:
+ del self._until[ until ]
+
def _convertDateTime( self, value ):
if value is None:
return value
More information about the Zope-Checkins
mailing list