[Zope] problem with "old" dates

John Schinnerer johnschinnerer@yahoo.com
Sun, 21 Apr 2002 14:12:15 -0700 (PDT)


Hello,

I built a simple searchable image gallery using a ZClass and the
default Catalog (zope 2.4.1).  Gallery items have a field of type
'date' to store the image creation date.

So far all the dates I've entered have been very recent (1999 and up).

Then I added an image of a sketch done in August of 1957.  It added
fine, and reindexing the catalog caused no complaints.  However, after
that any gallery search that would have included that item in the
result fails and returns a zope error.

If the search does not return that item everything still works fine.

If I change the year from 1957 to something recent like 1997 or 2000,
it works fine.  I haven't nailed down exactly what year it fails at
because I'm hoping someone already knows...

>From the traceback (last few lines included below) it looks like
safegmtime in DateTime.py is choking on this date.  The actual
exception text in safegmtime says 'The time %f is beyond the range of
this Python implementation.'

I'm finding it just a little hard to believe that it can't handle 1957
correctly...??  I'm entering years as four digits (e.g. 1957, not 57). 
There appears to be a y2k patch in DateTime.py that just assumes 69 and
lower is in the 21st century - not sure if that comes into play here
but if so there goes anything before 1970.

If pre-1970 (or whenever the limit is) dates can't be correctly handled
as date types, do I have any recourse for "old" dates other than having
to store the date as a string?  I'm using 'date' because sometimes I
want to display just the year, sometimes the month and year, etc. using
the 'built-in' output formatting.

And why no problem adding and cataloging the item?  Seems like a date
that can't be handled properly later on should be caught there...

thanks,
John S.

---------------
last few lines of traceback:
...
  File C:\Program
Files\Zope241\lib\python\DocumentTemplate\DT_String.py, line 546, in
__call__
    (Object: searchresults)
  File C:\Program Files\Zope241\lib\python\DocumentTemplate\DT_In.py,
line 669, in renderwb
    (Object: Catalog)
  File C:\Program Files\Zope241\lib\python\DocumentTemplate\DT_Var.py,
line 311, in render
    (Object: date)
    (Info: ('date', DateTime('1957/08/01'), {'fmt': '%B %Y', '':
'date'}))
  File C:\Program Files\Zope241\lib\python\DateTime\DateTime.py, line
1674, in __call__
  File C:\Program Files\Zope241\lib\python\DateTime\DateTime.py, line
1402, in strftime
  File C:\Program Files\Zope241\lib\python\DateTime\DateTime.py, line
461, in safegmtime





__________________________________________________
Do You Yahoo!?
Yahoo! Games - play chess, backgammon, pool and more
http://games.yahoo.com/