[Zope] Re: Trouble With Python Script
Maik Jablonski
maik.jablonski@uni-bielefeld.de
Thu, 10 Oct 2002 17:08:15 +0200
Don't declare the function indexCSS. Your PythonScript IS the function
indexCSS.
this one works for me without any problems:
**
import string
size = string.atoi(size)/1280
css = ".headline { position: absolute; top: " + str(100*size) + "}"
return css
**
cheers, maik
beno wrote:
> Your script gave me the same error (see error below). I even tried this
> simpler script:
>
> import string
>
> def indexCSS(size):
> size = string.atoi(size)/1280
> css = ".headline { position: absolute; top: " + str(100*size) + "}"
> return css
>
> and got the same error. Someone please help!
> TIA,
> beno
>
> At 12:47 PM 10/10/2002 +0200, you wrote:
>
>> beno wrote:
>>
>>> Hi;
>>> I'm trying to add a python script and running into this error:
>>> Error Type: TypeError
>>> Error Value: indexCSS() takes no arguments (1 given)
>>> I click the *Script (Python)* button from the pull-down menu and add
>>> the script *indexCSS* thus:
>>> ## CSS for index_frame.zpt of TELEVISION.VI
>>> ##
>>> ##parameters=size
>>> ##
>>> ## I use a function I've already built--but include afresh within
>>> this file--called sizeCalc2()
>>> ## I also utilize lamda functions inline, converting the int to a string
>>> ##
>>> import string
>>> def sizeCalc2(x,y):
>>> y = string.atoi(y)
>>> x = int(round(x*y/1280))
>>> return x
>>> def indexCSS(size):
>>> css = ".headline { position: absolute; top:
>>> "+str(sizeCalc2(100,size))+"; left: "+str(sizeCalc2(200,size))+"; }"
>>> return css
>>
>>
>> hi,
>>
>> you have to remove the function-declaration for indexCSS. so please
>> try this:
>>
>> ******
>> import string
>>
>> def sizeCalc2(x,y):
>> y = string.atoi(y)
>> x = int(round(x*y/1280))
>> return x
>>
>> css = ".headline { position: absolute; top:
>> "+str(sizeCalc2(100,size))+"; left: "+str(sizeCalc2(200,size))+"; }"
>> return css
>> ******