[Zope] Upgrade from 2.3.2 to 2.5.0
Evan Simpson
evan@zope.com
Thu, 07 Feb 2002 11:20:14 -0500
Chris Meyers wrote:
> If I save the script then everything works fine, but I don't really
> feel like going through all of the imported python scripts and
> saving them just to make sure they work. I have looked around on the
> list and on the various zope sites but haven't found any reference
> to any problem like this. So I guess my questions are: Has anyone
> seen this problem before, if so what did you do about it?
Ah, the older version of PythonScripts can have a _body without a
trailing newline, but 2.5's makes sure to add the newline at edit time.
I've added code to CVS to take care of this. In the meantime, you can
edit your Products/PythonScripts/PythonScript.py method "__setstate__"
to look like this:
def __setstate__(self, state):
Script.__setstate__(self, state)
if (getattr(self, 'Python_magic', None) != Python_magic or
getattr(self, 'Script_magic', None) != Script_magic):
body = self._body.rstrip()
if body:
self._body = body + '\n'
self._compile()
self._v_change = 1
elif self._code is None:
self._v_f = None
else:
self._newfun(marshal.loads(self._code))
...then restart and visit
"http://host/manage_addProduct/PythonScripts/recompile" to fix up all
Scripts.
Cheers,
Evan @ Zope