[Zope-Checkins] CVS: Zope/lib/python/Products/PluginIndexes/DateIndex - DateIndex.py:1.11
Andreas Jung
andreas@andreas-jung.com
Sun, 8 Jun 2003 04:56:59 -0400
Update of /cvs-repository/Zope/lib/python/Products/PluginIndexes/DateIndex
In directory cvs.zope.org:/tmp/cvs-serv3083/lib/python/Products/PluginIndexes/DateIndex
Modified Files:
DateIndex.py
Log Message:
- Collector #928: DateIndex ignored timezones when indexing and
querying
=== Zope/lib/python/Products/PluginIndexes/DateIndex/DateIndex.py 1.10 => 1.11 ===
--- Zope/lib/python/Products/PluginIndexes/DateIndex/DateIndex.py:1.10 Thu Jan 23 12:46:19 2003
+++ Zope/lib/python/Products/PluginIndexes/DateIndex/DateIndex.py Sun Jun 8 04:56:28 2003
@@ -11,7 +11,8 @@
#
##############################################################################
-"""$Id$ """
+"""$Id$
+"""
from DateTime.DateTime import DateTime
from Products.PluginIndexes import PluggableIndex
@@ -168,12 +169,14 @@
def _convert( self, value, default=None ):
"""Convert Date/Time value to our internal representation"""
+ # XXX: Code patched 20/May/2003 by Kiran Jonnalagadda to
+ # convert dates to UTC first.
if isinstance( value, DateTime ):
- t_tup = value.parts()
+ t_tup = value.toZone('UTC').parts()
elif type( value ) in (FloatType, IntType):
t_tup = time.gmtime( value )
elif type( value ) is StringType:
- t_obj = DateTime( value )
+ t_obj = DateTime( value ).toZone('UTC')
t_tup = t_obj.parts()
else:
return default