We just got a new server and installed Zope2.5.0 on it and it seems to work fine (after realizing that it doesn't play well with python 2.2). However we have had a few problems/issues with export of our site over from the old server which is running Zope 2.3.2. Specifically we are getting problems with python scripts that end in an else: clause. For example a script from the export that looks like this: if context.noRequestID(): context.getRecentRequestID() else: context.getSelectedRequestID() gives this error: Script line 4 context.getSelectedRequestID() ^ SyntaxError: invalid syntax 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? Also is there a How-To available that describes migrating to a newer version of zope? I have seen this one: http://www.zope.org/Members/mcdonc/HowTos/zopeinstall/ZOPE-INSTALL-HOWTO but it seems a little dated now (no offense to the author). Thanks for any help. System Specs RedHat 7.2 Python 2.1.2 Old zope 2.3.2 New zope 2.5.0 -- Chris Meyers 7941 Tree Lane Suite 200 Madison WI 53717
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
participants (2)
-
Chris Meyers -
Evan Simpson