[Zope] Persistence in Python Scripts

Evan Simpson evan@4-am.com
Thu, 8 Mar 2001 12:28:37 -0600


From: "Cyril Elkaim" <cyril.elkaim@free.fr>
> The following code seems to trigger the Persistance machinery.
> Is it true?
[snip]
> The reason I ask this question is that sometimes I get Conflict Error
> when this script is executed. It's the case when it's called many times
> in the same document.

This is probably due to a typo in the 2.3.0 release.  Check the file
PythonScript.py in the PythonScripts Product for the following line:

        if getattr(self, Python_magic, None) != Python_magic:

...and change it to:

        if getattr(self, 'Python_magic', None) != Python_magic:

The lack of quotes causes this line to fail every time a Script is loaded,
resulting in unnecessary recompilation of the Script object, triggering
Persistence.  It's fixed in the most recent release.

Cheers,

Evan @ digicool & 4-am