Commit 59d8d375 authored by Andreas Jung's avatar Andreas Jung

- Collector #928: DateIndex ignored timezones when indexing and

        querying
parent 097d0a30
......@@ -57,6 +57,9 @@ Zope Changes
Bugs Fixed
- Collector #928: DateIndex ignored timezones when indexing and
querying
- Collector #892: misleading error msg when initializing an OIBTree
from a dict with a float value. The message claimed that the
dict's items didn't consist of 2-element tuples, but of course
......
......@@ -11,7 +11,8 @@
#
##############################################################################
"""$Id: DateIndex.py,v 1.10 2003/01/23 17:46:19 andreasjung Exp $ """
"""$Id: DateIndex.py,v 1.11 2003/06/08 08:56:28 andreasjung Exp $
"""
from DateTime.DateTime import DateTime
from Products.PluginIndexes import PluggableIndex
......@@ -168,12 +169,14 @@ class DateIndex(UnIndex):
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
......
......@@ -80,7 +80,7 @@ class DI_Tests(unittest.TestCase):
if type(date) in (FloatType, IntType):
yr, mo, dy, hr, mn = time.gmtime(date)[:5]
else:
yr, mo, dy, hr, mn = date.parts()[:5]
yr, mo, dy, hr, mn = date.toZone('UTC').parts()[:5]
return (((yr * 12 + mo) * 31 + dy) * 24 + hr) * 60 + mn
def test_empty(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment