[Zope-DB] Problem with TALES DateTime conversion

Dieter Maurer dieter@handshake.de
Fri, 14 Mar 2003 00:01:02 +0100


Charlie Clark wrote at 2003-3-11 23:52 +0100:
 > I seem to have come across a bug in datetime formatting in TALES.
 > 
 > I have dates and timestamps in my database but only seem to be able to 
 > format timestamps with strftime.
 > 
 > ie.
 > <br tal:content="python: result.mytimestamp.strftime('%d.%m.%Y')>
 > works fine when applied to timestamps 
 > 
 > but I get the following error when I apply it to date values
 > 
 > Error Type: TALESError
 > Error Value: exceptions.IOError on [Errno 22] Invalid argument in "", at 
 > line 53, column 1

This is not a TALES error (or problem):

   Your database adapter does not represent date values
   as DateTime objects (and therefore, you cannot use "strftime").

Check what type is used for data values.

  You use an External Method for this which
  returns "str(type(aDateObject))".


Dieter