[Zope] External Methods tricky point

Brian Takashi Hooper brian@garage.co.jp
Mon, 28 Feb 2000 11:50:45 +0900


Hi everyone,

I just thought that I would pass along this tidbit for anyone that might
be interested - we just finished figuring out a problem that was causing
massive slowdown on our Zope site, as a result of ZODB lock
contention... here's what to look out for:

I had written an External Method something like:

import re

def foo(my_re=re.compile(r' ... ')):
    ...

where I had a default argument that used the re module.  For reasons
that I don't yet understand, every time this External Method was called
it registered an attribute change, and was rewritten to the ODB, causing
every page view to require a write access.

I solved the problem by rewriting my EM to use ts_regex instead -
however, it would be nice to know what might have been causing this to
happen...

Any ideas?

--Brian