[Zope] Problems requesting SQL date fields

Jay Ashton jay@tomigaya.shibuya.tokyo.jp
Sat, 27 Feb 1999 12:25:54


>Michel Pelletier <michel@digicool.com> wrote:
>
>>Alexander Schad <ags@beehive.de> wrote:
>>
>> I have connected my zope server with a SQL-Server but when 
>> i'm requesting
>> a date field a get an error. Can anybody tell me what might 
>> went wrong?
>> 
>
>Maybe.  This is not even close to enough information for us to consider
>looking at this problem.


Without more info this suggestion is just a shot in the dark, but as Brian
Hooper wrote a few days ago, here in Tokyo he and I recently had a hell of
a time with SQL date fields. (If you've already seen his post and it's not
relevant, apologies - and please disregard the rest of this...)

We had no problem inserting datetime values into MySQL, but when requesting
the values Zope wasn't able to parse them. We finally figured out that NT 4
was returning 'Tokyo Standard Time' as the time zone value, which Zope
didn't recognize and couldn't deal with. Thus if you're in Germany and have
your system time zone set appropriately, this _may_ be the cause of your
trouble as well. I've included part of Brian's post below with the fix -
if, in case, this is the cause of your ills.

- Jay

>Brian Hooper <brian@garage.co.jp> wrote:
>
>MySQL select queries were mysteriously failing with a parse error in RDB.py, 
>related to not being able to parse a DATETIME field.  
>
>After looking at DateTime.py and concluding that DateTime should be able to 
>parse virtually anything ;-), we were initially very puzzled as to the cause 
>of the parse error.  However, after eliminating everything else we could
>think of, we finally found that it was the fact that NT was returning the
>value 'Tokyo Standard Time' as the timezone for our machine - a value which
>is not listed in the _zmap in DateTime - so, DateTime was failing here:
>
>                # Current time, exp in specified timezone
>                t,tz=time(),self._tzinfo._zmap[lower(arg)]
>
>We added the mapping 'tokyo standard time':'Tokyo' to _zmap, restarted Zope,
>and now everything's working fine.