[Zope] Forms + MySQL + DateTime = a mess

Richard Wesley hawkfish@electricfish.com
Mon, 12 Aug 2002 08:23:44 -0700


At 7:52 PM -0700 8/5/02, Dennis Allison wrote:
>I think I have finally traced down at least some of my problem.
>The MySQL DA adaptor is smart -- for DateTime columns it wants a
>DateTime object and it returns a DateTime object.  Mixing strings
>and DateTime objects is not a good idea so I have modified my
>stuff to keep everything as a string until it goes into the
>database (or there's a need for a DateTime quantity) and, when
>it comes out from the database and is needed as a string, I
>force an explicit conversion.  Simple, but hard to track down when
>the infomation flow is complex.

I was going to respond by telling you to do just this ;-)

In general, I find that I need to treat everything entered by the 
user as a string and convert it to the db type as part of the 
validation process.
Sincerely,

Richard Wesley
Co-President, Electric Fish, Inc.
<http://www.electricfish.com/>
(v) +1-206-493-1690x210
(f) +1-206-493-1697