[Zope] on dates

Cliff Ford Cliff.Ford at ed.ac.uk
Mon Oct 11 13:57:32 EDT 2004


You could try writing a wee Python script. This one gets the date from 
the query:

for result in context.theQuery():
     print result.theDate.strftime('%H:%M, %a %d %b, %Y')
return printed

Then call the script from the template.

Alternatively, you could pass the date string to the Python script.

Actually, I call a dtml object from a template, and the dtml calls the 
script (because the dtml has some extra HTML layout and the python does 
the date formatting - so the template looks uncomplicated).

Cliff

massimop at users.berlios.de wrote:
> I'm trying to format a Date retrieved from MySQL, but while I can print
> the date as it is I can't access any of the methods, so no strftime()
> and no day() etc
> I get a 'not allowed in this context' exception
> so:
> <i tal:content="python:item.data"></i>
> is ok but:
> <i tal:content="python:item.data.day"></i>
> causes Zope to ask for authentication
> 
> Zope 2.7.2, Python 2.3.4 here
> any hint would be appreciated
> 
> thanks
> massimo
> 
> 
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> 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 )


More information about the Zope mailing list