[Zope] Re: Trouble With Python Script

Maik Jablonski maik.jablonski@uni-bielefeld.de
Thu, 10 Oct 2002 12:47:32 +0200


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