Re: patch that makes saveChanges optional on session destruction in zope

Sebastien Bigaret <[email protected]> 22 Jun 2004 20:38:40 +0200
Newsgroups gmane.comp.python.modeling
Message-ID <[email protected]>
John Lenton <[email protected]> wrote:
> hmm... now I'm not so certain the patch actually did what we
> wanted. In fact, reading the code, I see that saveChanges is called
> when bind_saveChanges_to_zope_transactions is true, and _finish is
> called on the ECProxy. AFAICT, saveChanges is *not* called on session
> destruction unless that property is set, and then it is called at
> every request end, right?

Yes, you're right, except that saveChanges() is in fact *never* called
upon session destruction.

  I did not see what your intent was when I read your message; if you
  want read-only (ie. no saveChanges() being called on a session's ec),
  then you simply set bind_saveChanges_to_zope_transactions to false.

And you're right, too, about the patch, since it has no effect unless
saveChanges() is bound to zope txn, in which case it has the same effect
(binding saveChange() to the zope txn).

  Glad you notice, I did not pay enough attention indeed.


Now while we're at it (even if I have no use-case in mind for this):
maybe the ability to control independently whether a session's ec should
be saved upon session destruction might be useful?

-- Sébastien.


> Sender: John Lenton <[email protected]>
> 
> On Sun, Jun 20, 2004 at 05:38:29PM +0200, Sebastien Bigaret wrote:
> > 
> > John Lenton <[email protected]> wrote:
> > > This patch adds a boolean property to the ZEditingContextSessioning
> > > zope product that controls whether saveChanges is called upon session
> > > destruction. Defaults to true (i.e., do saveChanges).
> > > 
> > > It's a very simple patch, but it does what we needed (building a web
> > > application that needs to ensure atomicity of a complex object that is
> > > created in multiple stages).
> > 
> >   Thanks for the patch, it will be integrated into the next release.
> > Before releasing we'll need to update the documentation at
> > ZECSessioning/README and MDL/doc/UserGuide/FrameworkTypicalUsage.tex.
> > Email me privately if by any chance you think you could find some time
> > for this this week.
> 
> hmm... now I'm not so certain the patch actually did what we
> wanted. In fact, reading the code, I see that saveChanges is called
> when bind_saveChanges_to_zope_transactions is true, and _finish is
> called on the ECProxy. AFAICT, saveChanges is *not* called on session
> destruction unless that property is set, and then it is called at
> every request end, right?
> 
> Pass me the paper bag :(



-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com