[Zope-dev] ZODB Competing read/writes: How to find out which attribute?
Jim Fulton
jim at zope.com
Sun Oct 11 09:16:28 EDT 2009
On Sat, Oct 10, 2009 at 10:00 PM, Shane Hathaway <shane at hathawaymix.org> wrote:
> Hermann Himmelbauer wrote:
>> That's exactly the problem - it's a read operation and there should not be any
>> write operation involved. However, it's hard to find out where the write
>> operation in my code occurs, I can't find it in the view, maybe there's
>> something in the authentication code, but I'd have to dig deep through my
>> source. So It would be extremely helpful to know a faster way to find out
>> what code triggered this warning.
>
> The code that modifies something will indirectly call the register()
> method of the ZODB.Connection class. If you arrange for
> Connection.register() to raise an exception when the transaction is not
> supposed to modify anything, you should get a traceback that pinpoints
> what is doing the modification. Unfortunately, there is no API for
> that, so the easiest thing to do is modify the source code of the
> register() method in ZODB.Connection. Fortunately, this is Python, so
> modifying someone else's code is usually quite easy. :-)
Easier yet, in a development environment, add a breakpoint in register
and make a read-only request to see what's causing it to be called and
why.
Jim
--
Jim Fulton
More information about the Zope-Dev
mailing list