[Zope-CMF] Python 2.0-isms in FSPythonScript

Chris Withers chrisw@nipltd.com
Fri, 1 Jun 2001 23:17:45 +0100


This is a multi-part message in MIME format.

------=_NextPart_000_026E_01C0EAF1.10798070
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

> Tres Seaver <tseaver@palladion.com> writes:
>
> > > Error Type: AttributeError
> > > Error Value: 'string' object has no attribute 'split'
>
> > >   File D:\ChrisW\Zope\current\Products\CMFCore\FSPythonScript.py, line
194,
> > > in ZScriptHTML_tryParams
>
> > 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:
>

> Tracker? Or is Zope 2.4.x / Python 2.x a requirement for CMF 1.1?

Well, here's a patch which fixes the problem for python 1.5.2...

cheers,

Chris

------=_NextPart_000_026E_01C0EAF1.10798070
Content-Type: application/octet-stream;
	name="FSPythonScript.py.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="FSPythonScript.py.patch"

--- FSPythonScript.py.1	Thu May 31 20:44:18 2001
+++ FSPythonScript.py	Fri Jun 01 23:14:40 2001
@@ -85,7 +85,7 @@
 """Customizable Python scripts that come from the filesystem."""
 __version__='$Revision: 1.8 $'[11:-2]
 
-from string import split
+from string import split,strip
 from os import path, stat
 import new
 
@@ -191,10 +191,10 @@
     def ZScriptHTML_tryParams(self):
         """Parameters to test the script with."""
         param_names = []
-        for name in self._params.split(','):
-            name = name.strip()
+        for name in split(self._params,','):
+            name = strip(name)
             if name and name[0] != '*':
-                param_names.append(name.split('=', 1)[0])
+                param_names.append(split(name,'=', 1)[0])
         return param_names
 
     def read(self):

------=_NextPart_000_026E_01C0EAF1.10798070--