
REQUEST = container.REQUEST
patrix> If i inport a var from a dtml form to python the var coms
patrix> with ' ' THE peace of code
patrix> REQUEST = container.REQUEST Bdag = REQUEST['Bdag']
patrix> REQUEST = container.REQUEST Bmaand = REQUEST['Bmaand']
patrix> REQUEST = container.REQUEST Bjaar = REQUEST['Bjaar']
patrix> bdate = DateTime(Bjaar,Bmaand,Bdag,0,0,0)
patrix> THE error
patrix> Error Type: DateTimeError Error Value: Invalid date:
patrix> ('2002', '1', '1', 0, 0, 0)
patrix> so how i get the ' ' of the var
Maybe my eyes are just failing me, but in the exception
Error Type: DateTimeError Error Value: Invalid date:
('2002', '1', '1', 0, 0, 0)
I don't see any spaces, so this may not be your problem. However, you
are mixing strings and integers -- that looks suspicious.
Try this:
bdate = DateTime('%04d-%02d-%02d' % (int(year), int(month), int(day)))
This will create a formatted string like '2002-01-01' which date time
will be happy to process
Also, you do not need to set the request multiple times, the following
will do
REQUEST = container.REQUEST # or is context.REQUEST better?
year = REQUEST['Bdag']
month = REQUEST['Bmaand']
day = REQUEST['Bjaar']
bdate = DateTime('%04d-%02d-%02d' % (int(year), int(month), int(day)))
JDH