It suddenly dawned on me what the difference is between your python script and mine. This script works fine. But I would have thought that the "thedate" would be passed by dtml as a string. If that were the case then my version of your script would work: ndate = DateTime(thedate) m = ndate.Month() return "%s is the cruelest month" % m And indeed it does work when I run the test through the management screen. However, your example totally bypasses the DateTime() creation, assuming that thedate is already a DateTime() object whose methods only need to be accessed. This is evidence by the fact that your dtml works with your script, but fails in the test at the management screen. Pardon my ignorance in python, but can't you overload constructors in python? I am spoiled in this department by C++. it would be nice if DateTime(DateTime a) copied a DateTime object and DateTime(string b) created a new DateTime object. I just didn't know that dtml-sqlvar was already sending this database field as a datetime object, and I have no way of testing the script independent of the dtml, now.
# Pyscript "pyscript" # one parameter: "thedate"
m = thedate.Month() return "%s is the cruellest month" % m
I would still like info on zexp. I found an intro on Zope.org, but no other info. I like the concept.