[Zope] Python2.3 datetime VS Zope DateTime
Sakesun Roykiattisak
sakesun at boonthavorn.com
Fri Mar 26 07:43:44 EST 2004
In fact, I mean python2.3's datetime.datetime. However, with your hint,
I've found I can do this.
<dtml-let d="getInvoiceDate('INV10001')">
<dtml-var "_.DateTime(str(d)).strftime('%d/%m/%Y')">
</dtml-let>
or in ZPT
<span tal:omit-tag="" tal:define="d python:here.getInvoiceDate('INV10001')">
<span tal:replace="python:DateTime(str(d)).strftime('%d/%m/%y)"/>
</span>
Ther are pretty verbose. But it works anyway.
Thank you very much for your tip.
Small Business Services wrote:
>From: "Sakesun Roykiattisak" <sakesun at boonthavorn.com>
>
>
>>I'm now trying to publish a set of database-related logics through
>>zope. Some of them return a python2.3's datetime object which its
>>member access are disallowed from zope. (DTML, ZPT)
>>I want to access some of datetime's member-methods, like strftime &
>>isocalendar. How can I make it accessible from zope ? Or how can I make
>>Zope automagically convert it to Zope's DateTime. I really don't want
>>to change my logics to use Zope's DateTime.
>>
>>
>
>DateTime and strftime are accessible from dtml:
>
><dtml-let e="_.DateTime()">
> strftime(%Y/%m/%d) --> <dtml-var expr="e.strftime('%Y/%m/%d')">
></dtml-let>
>
>
>Jonathan
>
>
>
>
More information about the Zope
mailing list