[Zope] Python Syntax within DTML

Dieter Maurer dieter at handshake.de
Wed Aug 27 22:05:53 EDT 2003


Support Faults wrote at 2003-8-26 14:35 +0800:
 > I'm having a little trouble correctly referencing python within a DTML method.
 > I'm attempting to set some values using the dateclass class.
 > 
 > <input type='hidden' name='start_date' value='<dtml-var expr="date.toordinal()">'></input>
 > 
 > I'm just trying to get todays date in ordinal form, so that I can perform some manipulations upon it.
 > 
 > Do I need to use request.set or am I on the wrong tangent?

You did not tell us what happened, what went wrong...

Please do that in the future when you report problems.

Zope usually uses "DateTime.DateTime.DateTime" instance to
represent dates and times. Looking at their documentation,
they do not have a method "toordinal". "JulianDay" may be something
similar. Chack the documentation!

Guessing from your description, your "date" might be a Python 2.3
"date" instance. Almost surely, such classes do not have
the necessary Zope security declarations and accessing them
will probably raise an "Unauthorized" exception.


If this does not help you, come back with more information.
Do it straight away in the future!


Dieter



More information about the Zope mailing list