[Zope-Checkins] CVS: Zope2 - DT_Var.py:1.40.14.1

andreas@serenade.digicool.com andreas@serenade.digicool.com
Fri, 15 Jun 2001 13:59:15 -0400


Update of /cvs-repository/Zope2/lib/python/DocumentTemplate
In directory serenade:/tmp/cvs-serv8742/lib/python/DocumentTemplate

Modified Files:
      Tag: ajung-mxdatetime
	DT_Var.py 
Log Message:
savepoint


--- Updated File DT_Var.py in package Zope2 --
--- DT_Var.py	2001/04/27 20:59:34	1.40
+++ DT_Var.py	2001/06/15 17:58:44	1.40.14.1
@@ -225,6 +225,7 @@
 from string import find, split, join, atoi, rfind
 from urllib import quote, quote_plus
 from cgi import escape
+from mx.DateTime import now
 
 def html_quote(v, name='(Unknown name)', md={}):
     return escape(str(v), 1)
@@ -266,6 +267,7 @@
 
         val=self.expr
 
+
         if val is None:
             if md.has_key(name):
                 if have_arg('url'):
@@ -291,6 +293,7 @@
 
         # handle special formats defined using fmt= first
         if have_arg('fmt'):
+
             fmt=args['fmt']
             if have_arg('null') and not val and val != 0:
                 try:
@@ -314,7 +317,11 @@
                 elif special_formats.has_key(fmt):
                     val = special_formats[fmt](val, name, md)
                 elif fmt=='': val=''
-                else: val = fmt % val
+                elif type(val)==type(now()):
+                    val = val.strftime(fmt)
+                else: 
+                    print fmt, val
+                    val = fmt % val
 
         # finally, pump it through the actual string format...
         fmt=self.fmt