[Zope] set date property from External Method

Gijs Reulen greulen@gilsing.nl
Sat, 16 Sep 2000 18:02:51 +0200


I would like to set a property with type 'date' from an External Method.
Because the properties all seem to be saved as a string, in Python I do:

self.prop_datetime = time.strftime('%Y/%m/%d  %H:%M:%S.000

This results in a optically (!) correct value like:

2000/09/16  17:49:02.000 GMT+1

However, when I call a document which uses the date, as with:

<dtml-with prop_datetime>
<dtml-var "'%s %s om %s' % (dd(), aMonth(), TimeMinutes())">

Zope produces an error:

Zope has encountered an error while publishing this resource.
Error Type: NameError
Error Value: dd

The funny thing is, when I manage the properties and just do a 'save
changes', the error is gone and the date is displayed correctly ...
It seems to me that the date property is not saved as a string after all ?
But what then ? I tried self.prop_datetime = time.localtime(time.time()) and
self.prop_datetime = time.time(); both result in a string representing their
value but none of them results in a date/time value ....

Gijs Reulen