[Seaside] Closures not working even with fixTemps?

Lukas Renggli renggli at gmail.com
Tue Dec 18 19:18:08 UTC 2007

> renderNewModelButton: html
>   { M1. M2 } do:
>     [ : modelClass |
>        html submitButton
>        callback:
>          [ | newModel |
>            self session magma commit: [
>              newModel := self repository models add: modelClass new.
> 1>>          self halt] fixTemps.
>              self halt.
> 2>>          self call: (newModel viewerClass new model: newModel).
>              selectedModel := nil ] fixTemps;
>        value: #New , ' ' , modelClass name ]

It looks like this is indeed a bug in Squeak, as there are two blocks
that mess around and copy their home contexts.

As a first step I would put all the callback-code into a separate
method taking the modelClass as an argument. It is good practice not
to mix view (rendering) and controller (callbacks) functionality

You don't have to send #fixTemps to the callback-block, as Seaside
already does this for you. Moreover, it is called #fixCallbackTemps


Lukas Renggli

More information about the seaside mailing list