[Zope-dev] DateTime formatting with strftime: patch

Steve Alexander steve@cat-box.net
Mon, 24 Jul 2000 16:56:52 +0100


This is now in the Collector, as bug number 1457.

  http://classic.zope.org:8080/Collector/1457/view

Incidentally, http://classic.zope.org:8080/Collector/1409/view is
another patch to the same problem. However, that patch doesn't address
the root of the problem, which is that DateTime instances are associated
with a particular timezone, and users expect all formatting to occur
with respect to that particular timezone. The fix in collector #1409
makes all strftime formatting happen in the local timezone of the Zope
installation, not the timezone given in the particular DateTime instance
being formatted.


Steve Alexander wrote:
> 
> Here's a working patch to make formatting of a DateTime instance work as
> generally expected, when you use
> 
>   <dtml-var "_.DateTime()" fmt="%d %G %z">
> 
> or whatever.
> 
> It could be made more efficient by compiling the two regex (regexes?
> regexen? regular expressions :-) ) into class attributes.

There's a problem with this optimisation -- see my other posting to
zope-dev today.
 
--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net