Discussion:
[Modeling-users] patch that makes saveChanges optional on session destruction in zope
John Lenton
2004-06-18 13:52:00 UTC
Permalink
Sender: John Lenton <***@martina.fsl.org.ar>

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).

On the same front, we *might* be building a (very stupid) application
server---rather a Modeling server---for this, to enable simple
creation of multiple complex-object-that-is-created-in-multiple-stages.
I prototyped a readonly version in a night, and I think they liked
it :)
--
John Lenton (***@vialibre.org.ar) -- Random fortune:
Robar las ideas de una persona es plagio; robarlas de muchas es investigación.
-- Ley de Felson.
John Lenton
2004-06-18 14:15:04 UTC
Permalink
and now, the patch.
--
John Lenton (***@vialibre.org.ar) -- Random fortune:
Siempre que te pregunten si puedes hacer un trabajo, contesta que si y
ponte enseguida a aprender como se hace.
-- Franklin Delano Roosevelt.
Sebastien Bigaret
2004-06-20 13:41:01 UTC
Permalink
Hi John & all,
Post by John Lenton
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.
Post by John Lenton
On the same front, we *might* be building a (very stupid) application
server---rather a Modeling server---for this, to enable simple
creation of multiple complex-object-that-is-created-in-multiple-stages.
I prototyped a readonly version in a night, and I think they liked
it :)
That would be great --a "very stupid" application would definitely be
better than no sample code at all ;)

-- Sébastien.
John Lenton
2004-06-21 18:35:00 UTC
Permalink
Post by Sebastien Bigaret
Post by John Lenton
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 :(
--
John Lenton (***@vialibre.org.ar) -- Random fortune:
Government [is] an illusion the governed should not encourage.
-- John Updike, "Couples"
Sebastien Bigaret
2004-06-22 16:41:05 UTC
Permalink
Post by John Lenton
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.
Post by John Lenton
Post by Sebastien Bigaret
Post by John Lenton
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 :(
Loading...