Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Zope: Users

bug? pagetemplate using strftime

 

 

Zope users RSS feed   Index | Next | Previous | View Threaded


yourpadre at gmail

Apr 20, 2009, 7:33 PM

Post #1 of 10 (2466 views)
Permalink
bug? pagetemplate using strftime

Hi list,

This is a bug in strftime? add to report to launchpad?

<tr tal:repeat="item container/getData">
<td tal:content="python: item.fecha.strftime('%d-%m-%Y');">09-01-2009</td>
<td tal:content="item/fecha">2009/01/10</td>
</tr>

can someone confirm this?
using a database postgresql 8.3
zope 2.11.1
windows 2003

________________________________________
Lo bueno de vivir un dia mas
es saber que nos queda un dia menos de vida


akm at theinternet

Apr 20, 2009, 8:24 PM

Post #2 of 10 (2377 views)
Permalink
Re: bug? pagetemplate using strftime [In reply to]

+-------[ Miguel Beltran R. ]----------------------
| Hi list,
|
| This is a bug in strftime? add to report to launchpad?
|
| <tr tal:repeat="item container/getData">
| <td tal:content="python: item.fecha.strftime('%d-%m-%Y');">09-01-2009</td>
| <td tal:content="item/fecha">2009/01/10</td>
| </tr>
|
| can someone confirm this?
| using a database postgresql 8.3
| zope 2.11.1
| windows 2003

Zope DateTime objects revert to UTC when using strftime in all versions
of Zope. It's known, and doesn't seem to be thought of as a bug.

The response I received about this was something to the effect of "write your own DateTime"

--
Andrew Milton
akm [at] theinternet
_______________________________________________
Zope maillist - Zope [at] zope
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )


zopyxfilter at googlemail

Apr 20, 2009, 9:12 PM

Post #3 of 10 (2360 views)
Permalink
Re: bug? pagetemplate using strftime [In reply to]

I don't see any issue with that? If yes, provide the related output and what
you expect and why?

On Tue, Apr 21, 2009 at 04:33, Miguel Beltran R. <yourpadre [at] gmail>wrote:

> Hi list,
>
> This is a bug in strftime? add to report to launchpad?
>
> <tr tal:repeat="item container/getData">
> <td tal:content="python:
> item.fecha.strftime('%d-%m-%Y');">09-01-2009</td>
> <td tal:content="item/fecha">2009/01/10</td>
> </tr>
>
> can someone confirm this?
> using a database postgresql 8.3
> zope 2.11.1
> windows 2003
>
> ________________________________________
> Lo bueno de vivir un dia mas
> es saber que nos queda un dia menos de vida
>
> _______________________________________________
> Zope maillist - Zope [at] zope
> http://mail.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope-dev )
>
>


yourpadre at gmail

Apr 21, 2009, 4:56 PM

Post #4 of 10 (2357 views)
Permalink
Re: bug? pagetemplate using strftime [In reply to]

Sorry, I not say clear where is the bug
The original data is year 2009, month 01, day 10

2009/4/20 Miguel Beltran R. <yourpadre [at] gmail>

> Hi list,
>
> This is a bug in strftime? add to report to launchpad?
>
> <tr tal:repeat="item container/getData">
> <td tal:content="python:
> item.fecha.strftime('%d-%m-%Y');">09-01-2009</td>
>
Using strftime show day 09. Here is the error.


> <td tal:content="item/fecha">2009/01/10</td>

Here the day show correctly




> </tr>
>
> can someone confirm this?
> using a database postgresql 8.3
> zope 2.11.1
> windows 2003
>


lists at zopyx

Apr 21, 2009, 9:59 PM

Post #5 of 10 (2347 views)
Permalink
Re: bug? pagetemplate using strftime [In reply to]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Sorry but your description is pretty weak.

'item.fetcha' is what kind of instance? DateTime? datetime?

How to reproduce the behavior?

We need something that works on any system.

- - -aj
Am 22.04.2009 um 01:56 schrieb Miguel Beltran R.:

> Sorry, I not say clear where is the bug
> The original data is year 2009, month 01, day 10
>
> 2009/4/20 Miguel Beltran R. <yourpadre [at] gmail>
> Hi list,
>
> This is a bug in strftime? add to report to launchpad?
>
> <tr tal:repeat="item container/getData">
> <td tal:content="python: item.fecha.strftime('%d-%m-
> %Y');">09-01-2009</td>
> Using strftime show day 09. Here is the error.
>
> <td tal:content="item/fecha">2009/01/10</td>
> Here the day show correctly
>
>
>
>
> </tr>
>
> can someone confirm this?
> using a database postgresql 8.3
> zope 2.11.1
> windows 2003
>
>
>
> _______________________________________________
> Zope maillist - Zope [at] zope
> http://mail.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope-dev )


Mit freundlichen Grüßen/Kind regards,
Andreas Jung

- ---
ZOPYX Ltd. & Co. KG - Charlottenstr. 37/1 - 72070 Tübingen - Germany
Web: www.zopyx.com - Email: info [at] zopyx - Phone +49 - 7071 - 793376
Registergericht: Amtsgericht Stuttgart, Handelsregister A 381535
Geschäftsführer/Gesellschafter: ZOPYX Limited, Birmingham, UK
- ------------------------------------------------------------------------
E-Publishing, Python, Zope & Plone development, Consulting




-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Darwin)

iEYEARECAAYFAknupCYACgkQCJIWIbr9KYzlUQCfRfmRX+4S2f5J3/rbKYj7rY7E
+1UAoJQL6qOcc1bT9SbxR+H62S5z1Evk
=PZh0
-----END PGP SIGNATURE-----
_______________________________________________
Zope maillist - Zope [at] zope
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )


yourpadre at gmail

Apr 22, 2009, 3:06 PM

Post #6 of 10 (2348 views)
Permalink
Re: bug? pagetemplate using strftime [In reply to]

>
> 'item.fetcha' is what kind of instance? DateTime? datetime?
>
> How to reproduce the behavior?
>
> We need something that works on any system.
>

I don't know what type is.
How can know?


<tr tal:repeat="item container/getData">
<td tal:content="python: item.fecha.strftime('%d-%m-%Y');">09-01-2009</td>
<td tal:content="item/fecha">2009/01/10</td>
</tr>

getData is a zsql method what connect to postgresql using zpsycopgda 2.0
conecction with enconding utf-8 serializable (with zope internal datetime
option enabled and disabled) and not work :(

This problem happen too with ms sql server 2000 with zpyodbc. Using %d break
the day.


akm at theinternet

Apr 22, 2009, 4:21 PM

Post #7 of 10 (2342 views)
Permalink
Re: bug? pagetemplate using strftime [In reply to]

+-------[ Miguel Beltran R. ]----------------------
|
|
| 'item.fetcha' is what kind of instance? DateTime? datetime?
|
| How to reproduce the behavior?
|
| We need something that works on any system.
|
|
| I don't know what type is.
| How can know?
|
|
| <tr tal:repeat="item container/getData">
| <td tal:content="python: item.fecha.strftime('%d-%m-%Y'
| );">09-01-2009</td>
| <td tal:content="item/fecha">2009/01/10</td>
| </tr>
|
| getData is a zsql method what connect to postgresql using zpsycopgda 2.0
| conecction with enconding utf-8 serializable (with zope internal datetime
| option enabled and disabled) and not work :(
|
| This problem happen too with ms sql server 2000 with zpyodbc. Using %d break
| the day.

If you strftime to show the hour and minute too, you will see as I
previously said it is showing you the time in UTC (as determined by how
many hours is it out).

--
Andrew Milton
akm [at] theinternet
_______________________________________________
Zope maillist - Zope [at] zope
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )


yourpadre at gmail

May 7, 2009, 12:16 PM

Post #8 of 10 (2140 views)
Permalink
Re: bug? pagetemplate using strftime [In reply to]

>
> If you strftime to show the hour and minute too, you will see as I
> previously said it is showing you the time in UTC (as determined by how
> many hours is it out).
>
>
I made a test with date 2009/05/07 using
<dtml-var "fecha.timezone" > -- dmYzZ=<dtml-var fecha fmt="%d/%m/%Y %z %Z">
-- c=<dtml-var fecha fmt="%c"> -- x<dtml-var fecha fmt="%x"> -- X<dtml-var
fecha fmt="%X">

and show this
<bound )="" 07="" 05="" 2009="" datetime(="" of="" datetime.timezone=""
method=""> -- dmYzZ=06/05/2009 -- c=05/06/09 19:00:00 -- x05/06/09 --
X19:00:00</bound>

here I see what you said me, the hour is gmt-0500.


If add in zope.conf
<environment>
TZ America/Mexico_City
</environment>

or in runzope.bat
@set TZ=America/Mexico_City

nothing change, render the same what before add TZ

now, how I can show the correct date? help please
I use MS Sql Server 2000 with field smalldatetime
I never used before timezone.


akm at theinternet

May 7, 2009, 12:26 PM

Post #9 of 10 (2128 views)
Permalink
Re: bug? pagetemplate using strftime [In reply to]

+-------[ Miguel Beltran R. ]----------------------
|
|
| If you strftime to show the hour and minute too, you will see as I
| previously said it is showing you the time in UTC (as determined by how
| many hours is it out).
|
|
|
| I made a test with date 2009/05/07 using
| <dtml-var "fecha.timezone" > -- dmYzZ=<dtml-var fecha fmt="%d/%m/%Y %z %Z"> --
| c=<dtml-var fecha fmt="%c"> -- x<dtml-var fecha fmt="%x"> -- X<dtml-var fecha
| fmt="%X">
|
| and show this
| <bound )="" 07="" 05="" 2009="" datetime(="" of="" datetime.timezone="" method=
| ""> -- dmYzZ=06/05/2009 -- c=05/06/09 19:00:00 -- x05/06/09 -- X19:00:00</
| bound>
|
| here I see what you said me, the hour is gmt-0500.
|
|
| If add in zope.conf
| <environment>
| TZ America/Mexico_City
| </environment>
|
| or in runzope.bat
| @set TZ=America/Mexico_City
|
| nothing change, render the same what before add TZ
|
| now, how I can show the correct date? help please
| I use MS Sql Server 2000 with field smalldatetime
| I never used before timezone.

You can't use stftime.
You have to manually build a string with the format you want using the
other methods inside DateTime.

e.g. fetcha.aCommonZ() or build up your date using
components such as; fetcha.day() fetcha.month() fetcha.year()

--
Andrew Milton
akm [at] theinternet
_______________________________________________
Zope maillist - Zope [at] zope
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )


yourpadre at gmail

May 8, 2009, 11:31 AM

Post #10 of 10 (2130 views)
Permalink
Re: bug? pagetemplate using strftime [In reply to]

>
>
>
> You can't use stftime.
> You have to manually build a string with the format you want using the
> other methods inside DateTime.
>
> e.g. fetcha.aCommonZ() or build up your date using
> components such as; fetcha.day() fetcha.month() fetcha.year()
>
>

I made a script what recive a parameter fecha(f)
script pFecha:
s="%02d-%02d-%04d"
s=s % (f.day(),f.month(),f.year())
print s
return printed


the call is <td tal:content="python: container/pFecha(item.fecha)">

Thanks

Zope users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.