[Zope] Date formatting problems

Felipe E. Barousse Boue fbarousse@piensa.com
Wed, 13 Jun 2001 11:21:21 -0500


This is a multi-part message in MIME format.
--------------BBB0174D9BDDD9058B534CCC
Content-Type: multipart/alternative;
 boundary="------------74F1CC370896338981B0CA47"


--------------74F1CC370896338981B0CA47
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Craig:

I have my Python compiled with --locale and all the LC_ variables set to my locale's specifics for Mexico.

LANGUAGE=es_MX
LC_ALL=es_MX
LANG=es_MX

Zope is started with the -L parameter on the  /usr/local/Zope/start  script  :

#! /bin/sh
export TZ="America/Mexico_City"
#umask 077 for worldpilot use
umask 077
reldir=`dirname $0`
export Z_REALM='this system: '
PYTHONHOME=`cd $reldir; pwd`
export PYTHONHOME
exec /usr/bin/python \
     $PYTHONHOME/z2.py -u nobody -L es_MX -p '/home/httpd/somedirectory/zope-cgi-bin/Zope.cgi' \
       "$@"


Then what I use for date formatting in DTML methods is:

<dtml-call "ZopeTime().strftime('%Y%m%d%H%M%S')">   or
<dtml-var "ZopeTime().strftime('%Y%m%d%H%M%S')">   or
<dtml-call "REQUEST.set('somevariable', ZopeTime().strftime('%Y%m%d%H%M%S'))">     when you need to set a variable with a date

The %Y %m %d $H %M %S  are formatting strings to the strftime functions.  Look at the Zope Quick Reference for more information on this formatting variables, some of them DO use the locale settings
defined above. You can control what you get on date formatting with strftime().

Hope this helps.

Felipe Barousse
Bufete Consultor de Mexico - Piensa Technology


> Message: 13
> To: zope@zope.org
> From: "Craig Stoddart"
> Date:  13 Jun 2001 16:23:00 -0000
> Subject: [Zope] Date formatting problems
>
> I am trying to format the dates in my Squishdot site so that they don't app=
> ear
> in American format.
>
> However, the following code:
> results in an error message saying
>
> Error Type: TypeError
> Error Value: illegal argument type for built-in operation
>
> Does anyone have any idea what I am doing wrong=3F
> -------------------------------------------------
> Craig Stoddart
> IT Software Development Officer
>
> Dundee City Council
> IT Division
> Northern College
> Technical Block
> Gardyne Road
> Dundee DD5 1NY
>
> Phone:  01382 438170
> Fax:    01382 438002
> E-mail: craig.stoddart@dundeecity.gov.uk
> -------------------------------------------------
>
>

--------------74F1CC370896338981B0CA47
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Craig:
<p>I have my Python compiled with --locale and all the LC_ variables set
to my locale's specifics for Mexico.
<p>LANGUAGE=es_MX
<br>LC_ALL=es_MX
<br>LANG=es_MX
<p>Zope is started with the -L parameter on the &nbsp;/usr/local/Zope/start&nbsp;
script&nbsp; :
<p>#! /bin/sh
<br>export TZ="America/Mexico_City"
<br>#umask 077 for worldpilot use
<br>umask 077
<br>reldir=`dirname $0`
<br>export Z_REALM='this system: '
<br>PYTHONHOME=`cd $reldir; pwd`
<br>export PYTHONHOME
<br>exec /usr/bin/python \
<br>&nbsp;&nbsp;&nbsp;&nbsp; $PYTHONHOME/z2.py -u nobody -L es_MX -p '/home/httpd/somedirectory/zope-cgi-bin/Zope.cgi'
\
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "$@"
<br>&nbsp;
<p>Then what I use for date formatting in DTML methods is:
<p>&lt;dtml-call "ZopeTime().strftime('%Y%m%d%H%M%S')">&nbsp;&nbsp; or
<br>&lt;dtml-var "ZopeTime().strftime('%Y%m%d%H%M%S')">&nbsp;&nbsp; or
<br>&lt;dtml-call "REQUEST.set('somevariable', ZopeTime().strftime('%Y%m%d%H%M%S'))">&nbsp;&nbsp;&nbsp;&nbsp;
when you need to set a variable with a date
<p>The %Y %m %d $H %M %S&nbsp; are formatting strings to the strftime functions.&nbsp;
Look at the Zope Quick Reference for more information on this formatting
variables, some of them DO use the locale settings defined above. You can
control what you get on date formatting with strftime().
<p>Hope this helps.
<p>Felipe Barousse
<br>Bufete Consultor de Mexico - Piensa Technology
<br>&nbsp;
<blockquote TYPE=CITE>
<pre>Message: 13
To: zope@zope.org
From: "Craig Stoddart"&nbsp;<craig.stoddart@dundeecity.gov.uk>
Date:&nbsp; 13 Jun 2001 16:23:00 -0000
Subject: [Zope] Date formatting problems

I am trying to format the dates in my Squishdot site so that they don't app=
ear
in American format.

However, the following code:&nbsp;<dtml-var date=5Fcreated fmt=3D"%d/%m/%Y - %H:=
%M">
results in an error message saying

Error Type: TypeError
Error Value: illegal argument type for built-in operation

Does anyone have any idea what I am doing wrong=3F
-------------------------------------------------
Craig Stoddart
IT Software Development Officer

Dundee City Council
IT Division
Northern College
Technical Block
Gardyne Road
Dundee DD5 1NY

Phone:&nbsp; 01382 438170
Fax:&nbsp;&nbsp;&nbsp; 01382 438002
E-mail: craig.stoddart@dundeecity.gov.uk
-------------------------------------------------

</pre>
</blockquote>
</html>

--------------74F1CC370896338981B0CA47--

--------------BBB0174D9BDDD9058B534CCC
Content-Type: text/x-vcard; charset=us-ascii;
 name="fbarousse.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Felipe E. Barousse Boue
Content-Disposition: attachment;
 filename="fbarousse.vcf"

begin:vcard 
n:Barousse Boue;Felipe E.
x-mozilla-html:FALSE
org:Bufete Consultor de Mexico;Piensa Technology
adr:;;;;;;
version:2.1
email;internet:fbarousse@piensa.com
title:CEO - Director General
note;quoted-printable:Mailing address:=0D=0AAp. Cap Polanco # 336=0D=0AMexico City, DF. 11550=0D=0AMexico
x-mozilla-cpt:;28288
fn:Felipe E. Barousse Boue
end:vcard

--------------BBB0174D9BDDD9058B534CCC--