REQUEST = container.REQUEST
Tim Roberts
timr at probo.com
Sat May 10 01:15:46 EDT 2003
pheer at chello.nl (patrix) wrote:
>If i inport a var from a dtml form to python the var coms with ' '
>
>THE peace of code
>
>REQUEST = container.REQUEST
>Bdag = REQUEST['Bdag']
>
>REQUEST = container.REQUEST
>Bmaand = REQUEST['Bmaand']
>
>REQUEST = container.REQUEST
>Bjaar = REQUEST['Bjaar']
>
>bdate = DateTime(Bjaar,Bmaand,Bdag,0,0,0)
>
>THE error
>
>Error Type: DateTimeError
>Error Value: Invalid date: ('2002', '1', '1', 0, 0, 0)
>
>so how i get the ' ' of the var
I'm surprised at that particular error, instead of "__init__() takes at
most 2 arguments"..
DateTime takes a time tuple as a parameter, which has 9 integer elements,
not 6. You can convert the strings to ints using the "int()" operator.
Note that you need TWO sets of parens: one for the function, one for the
tuple:
bdate = DateTime((int(Bjaar),int(Bmaand),int(Bdag),0,0,0,0,0,0))
--
- Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the Python-list
mailing list