using dtml-var with fmt discount 1 day

Bug #306960 reported by Miguel Beltrán Rivera
2
Affects Status Importance Assigned to Milestone
Zope 2
Invalid
Undecided
Unassigned

Bug Description

Displaying a value type date from MSSQLSERVER 2000
<dtml-in somezsql>
   Date 1 is:<dtml-var field_date fmt="%d/%m/%Y">
   Date 2 is:<dtml-var field_date >
</dtml-in>

Show
Date is: 30/11/2008
Date is: 1/12/2008

Using print in DT_Var.py I found what the error is around here, line 268

                # We duplicate the code here to avoid exception handler
                # which tends to screw up stack or leak
                print "3. fmt=%s. val=%s" % (fmt, val)
                if hasattr(val, fmt):
                    print "31. fmt=%s. val=%s" % (fmt, val)
                    val = _get(val, fmt)()
                    print "311. fmt=%s. val=%s" % (fmt, val)
                elif special_formats.has_key(fmt):
...
line 292 --> print "4. val=%s" % val

From command line show the prints
3. fmt=%Y/%m/%d. val=2008/12/01
31. fmt=%Y/%m/%d. val=2008/12/01
311. fmt=%Y/%m/%d. val=2008/11/30
4. val=2008/11/30
4. val=2008/12/01 <-val without fmt

The error is the "_get" function, but my skins no enough for a patch

I use
 Zope Version
(Zope 2.11.1-final, python 2.4.4, win32)

Python Version
2.4.4 (#71, Oct 18 2006, 08:34:43) [MSC v.1310 32 bit (Intel)]

System Platform
win32

SOFTWARE_HOME
C:\Zope\2.11.1\Zope\lib\python

ZOPE_HOME
C:\Zope\2.11.1\Zope

INSTANCE_HOME
C:\Zope\Instance\aficon

CLIENT_HOME
C:\Zope\Instance\aficon\var

Network Services
ZServer.HTTPServer.zhttp_server (Port: 80)

Process Id
416 (300)

Running For
20 min 34 sec

Revision history for this message
Miguel Beltrán Rivera (yourpadre) wrote :

I hope what can help you this information

Date: 1999/10/03
Final result: 02/10/1999

Using "print" over various parts show me this, in order how appear:
1.- In function DateTime._julianday (around line 198, print before "if m >12L": print y,m,d show Y=1999 - M=10 - D=03

2.- In function DateTime._julianday (print before return): the final value of "b" is "-13"

3.- In function DateTime._calDependentSecond2 (around line 155, print before return x): the value "x" is "3116361600"
4.- In function DateTime.strftime (print before tzdiff minus): "ltz" is "GTM-6". This is correct.
5.- In function DateTime._tzoffset (executed by tzdiff = _tzoffset(ltz, self._t) - _tzoffset(self._tz, self._t)): show
tzoffset tz=GMT-6, t=1033603200.0
tzoffset= -21600
tzoffset tz=UTC, t=1033603200.0
tzoffset= 0
tzoffset tz=UTC, t=1033581600.0
tzoffset= 0
julian Y=2002 - M=10 - D=2
b= -13
(why enter again to julianday?)
6.- In function DateTime.strftime(print before return): show 02-10-1999

help please
some tip please

Revision history for this message
Miguel Beltrán Rivera (yourpadre) wrote :

Sorry, this not a bug.
Is a issue with gmt time. A explanation can be found here
http://www.gossamer-threads.com/lists/zope/users/221541?do=post_view_threaded#221541

Changed in zope2:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.