[Zope-CMF] FSPythonScript Problems

Tres Seaver tseaver@palladion.com
Fri, 01 Jun 2001 09:24:06 -0400


Chris Withers wrote:

> Hi,
> 
> I've got a file, addtoFavourites.py, which starts as follows on disk:
> 
> ## Script (Python) "addtoFavorites"
> ##title=Add item to favourites
> ##bind container=container
> ##bind context=context
> ##bind namespace=_
> ##bind script=script
> ##bind subpath=traverse_subpath
> ##parameters=
> 
> ...however, when I look at the resulting Zope object, the binding for
> namespace and the title appear to have been lost :-S


Because the mechanism we use for parsing FSPythonScripts is dropping
the title on the floor (because it isn't part of the "code object" of
the temporary PythonScript we create).  Please report this bug to the
tracker.


> Also, if I click the 'Try It' tab, I get the following error:
> Error Type: AttributeError
> Error Value: 'string' object has no attribute 'split'
>   File D:\ZOPE\23228D~1.2\lib\python\DocumentTemplate\DT_In.py, line 650, in
> renderwob
>     (Object: ZScriptHTML_tryParams)
>   File D:\ChrisW\Zope\current\Products\CMFCore\FSPythonScript.py, line 194,
> in ZScriptHTML_tryParams
>     (Object: addtoFavorites)
> AttributeError: (see above)


Without seeing the code, I'm guessing, but perhaps you are using
one of the new "string methods" (only available in Python 2.x) on
a Python 1.5.2 Zope?  The usage would be:

   tokenz = " ".split( token_string )

Which you will need to do via the string module in 1.5.2.:

   tokens = string.split( token_string, " " )

Tres.