[Zope] Re: Trouble With Python Script

beno zope@thewebsons.com
Thu, 10 Oct 2002 07:50:07 -0400


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
>******
>
>cheers, maik
>--
>Maik Jablonski                 __o
>www.zfl.uni-bielefeld.de     _ \<_    Deutsche Zope User Group
>Bielefeld, Germany          (_)/(_)               www.dzug.org
>
>
>
>
>_______________________________________________
>Zope maillist  -  Zope@zope.org
>http://lists.zope.org/mailman/listinfo/zope
>**   No cross posts or HTML encoding!  **
>(Related lists - http://lists.zope.org/mailman/listinfo/zope-announce
>http://lists.zope.org/mailman/listinfo/zope-dev )