[Zope3-dev] Calling persistent function

Stephan Richter srichter at cosmos.phy.tufts.edu
Mon Jan 26 14:06:16 EST 2004


On Monday 26 January 2004 10:58, Jim Fulton wrote:
> BTW, I'm surprised you didn't say we should the localized-date
> api.

You are right, I should have. But I did not think it was the point of the 
E-mail. ;-)

But yes you should be definitely using something like this (not tried, could 
have a typo):

from datetime import datetime
now = datetime.now()
formatter = request.locale.getDateTimeFormatter('long')
return formatter.format(now)

Eventually, you should be able to do this in zpt:

<p tal:content="datetime:now/format:long" />

which automatically localizes. Note that I have done the second part of this 
as a recipe in the cookbook as an example of creating a TALES namespace. The 
datetime namespace would not be much more difficult though.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training



More information about the Zope3-dev mailing list