Initialising DateTime object from SQL query
Hello everyone, Sorry in advance for the elongated description of my problem, I just want to make sure I include all the information that might be required... I have a dtml-method which will automaticly create date selection elements for a form. I pass it a default date in the form of a DateTime object. The value of the form elements is then initialised to this date. Normally I just run it like this: <dtml-var expr="selectDate_dtml(_.None,_,id='s',default=_.DateTime())"> Which sets the default date to the current one, and this works fine. However, sometimes I want to initialise this bit of the form with a date extracted from an SQL query. I can access the field in question without a problem as a normal variable: <dtml-var date_start> displays as 2002/02/08 Now, I know that this format is appropriate to pass to the constructer for DateTime, because when I type in a date by hand, it works fine: <dtml-var expr="selectDate_dtml(_.None,_,id='s',default=_.DateTime('2002/02/08'))"> However, when I pass the date_start variable to my dtml method as _.DateTime(date_start), I get the following error message: --- Zope Error Zope has encountered an error while publishing this resource. Error Type: TypeError Error Value: unsupported operand type(s) for / --- It looks like it isn't passing this variable to DateTime as a string, so how do I make it do that? Thanks in advance for any help you can offer. - Paul -- Paul Roberts <paul.m.roberts@sun.com>
participants (2)
-
Dieter Maurer -
Paul Roberts