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/
John Schinnerer writes:
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... It's probably a bug:
"safegmtime", at least in my 2.5 version, can handle dates between about 1904 and 2036. Apparently, the date returned by the catalog is garbled, probably for dates beyond 1970. I just tried to reproduce the problem. I did not succeed in my Zope 2.5 version. Dieter
Hello again, More info from my side of this question: I just tried to repro this problem on the 'live site' gallery search - took one date back to the offending 1957 even - it works there, no error. Only difference I am aware of is that my dev box is Win98, and my host machine is Debian linux. Both running Zope 2.4.1. Relevant code in DateTime.py (safegmtime) is identical in both systems. Looks like the crucial code is: try: t_int = int(t) except OverflowError: ...which raises an exception in Win98 but not linux on "old" dates. Can anyone confirm/explain this call failing in Win on year-dates that work in linux (beyond just Win-bashing, that is... ;-)?? thx, John S. __________________________________________________ Do You Yahoo!? Yahoo! Games - play chess, backgammon, pool and more http://games.yahoo.com/
hi zopistas John, I'm getting the same error... the problem is python for windoze, dates before 1970 doesn't work... :/ *in gnu/linux works like a charm* I posted the bug in collector: http://collector.zope.org/Zope/279 have a good work andré Em ter, 2002-04-23 às 02:12, John Schinnerer escreveu:
Hello again,
More info from my side of this question:
I just tried to repro this problem on the 'live site' gallery search - took one date back to the offending 1957 even - it works there, no error.
Only difference I am aware of is that my dev box is Win98, and my host machine is Debian linux. Both running Zope 2.4.1. Relevant code in DateTime.py (safegmtime) is identical in both systems. Looks like the crucial code is:
try: t_int = int(t) except OverflowError:
...which raises an exception in Win98 but not linux on "old" dates.
Can anyone confirm/explain this call failing in Win on year-dates that work in linux (beyond just Win-bashing, that is... ;-)??
thx, John S.
__________________________________________________ Do You Yahoo!? Yahoo! Games - play chess, backgammon, pool and more http://games.yahoo.com/
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
the problem is python for windoze, dates before 1970 doesn't work... :/ *in gnu/linux works like a charm*
I posted the bug in collector: http://collector.zope.org/Zope/279
If it's Python, then you should post a bug report in Python developers' conference, IMHO. -- Milos Prudek
participants (4)
-
André Camargo -
Dieter Maurer -
John Schinnerer -
Milos Prudek