[Zope] Python Methods Caveats?

Tres Seaver tseaver@palladion.com
Sun, 16 Apr 2000 17:55:37 -0500


Kapil Thangavelu <k_vertigo@yahoo.com> wrote:
> 
> I was wondering why Python Methods seem to make
> ZClasses very unstable. I've got a set of movies
> Zclasses that i'm adding in via xml-rpc (to an
> external method). The Classes and pages work fine
> until anyone of them calls a python method within the
> class that simply returns a fixed string date
> representation. At this point all the Movie ZClasses
> (instantations of one class) become broken through the
> zodb, and i get dumped a bunch of ZODB errors at the
> console about not being able to load state. i can
> still add in new movies. when i was writing this
> application things worked fine but now that i've
> shutdown and restarted zope i've been getting these
> errors. i vaguely remember chris petrelli (of dc)
> saying something about python methods being bad for
> zclasses at IPC8 (python conference). I realize that
> the solution to my problem is basically moving the
> python method outside the zclass (i hope) but i was
> wondering if anyone could shed any light on the why of
> the problem.

"Evan Simpson" <evan@4-am.com> replied:

> ----- Original Message -----
> From: Kapil Thangavelu <k_vertigo@yahoo.com>
> > I was wondering why Python Methods seem to make
> > ZClasses very unstable.
> 
> This is the first I've heard of this.  I make extensive use of PythonMethods
> in ZClasses (and elsewhere) without any problems.  Can you reduce the
> problem to a minimal example which can be exported?  If so, I may be able to
> help.

I believe the comment Chris made, and to which Kapil refers, was about
ExternalMethods inside ZClasses, and not PythonMethods.  I also frequently use
PM's inside ZClasses without any problems.

The assertion here seems to be that invoking a "read-only" PM breaks the
product/ZClass in which the PM lives.  Unless this is really a XXXPM, which also
does some really nasty stuff as side effects, I don't believe that this behavior
is possible (the code would need to be overwriting methods inside the ZClass, or
replacing the class ID string, or other similarly hostile behavior).

Please post the code to the method.

Tres.
-- 
=========================================================
Tres Seaver  tseaver@digicool.com   tseaver@palladion.com