[Seaside] Why does this work???

Richard K Eng richard.eng at rogers.com
Tue Apr 8 19:24:58 UTC 2008

I have a silly question...

I noticed that when I accidentally coded the following, it works...

session beginUnitOfWork.
anItem := session readOneOf: GRHistoryItem where: [...].
self call: (GROrderEditor new item: anItem).
session commitUnitOfWork.

...and in #GROrderEditor, I have a form that can modify the instance 
variables of #item...

html textArea rows: 5; on: #notes of: item].
html submitButton callback: [self answer: item]; text: 'Save'.
html cancelButton callback: [self answer: nil]; text: 'Cancel'.

Now, if I modify #notes in #item and then click on the submitButton, the 
changes are saved to the database.

If I modify #notes and then click on the cancelButton, the changes are NOT 

But what mystifies me is how does the session distinguish between what was 
returned in "answer: item" and what was returned in "answer: nil". Note that 
I don't assign the result of "self call:" to anything. It seems to me that, 
given how I coded the above, ANY modifications to #item (which is passed 
from #anItem in the #call:) should always be saved to the database. I'm not 
complaining, I'm glad that it works, but I want to understand why.

As I understand the call:/answer: mechanism, the above should NOT work.



More information about the seaside mailing list