Session is Lost (was Re: [Seaside] A progress bar for seaside)

Ramon Leon ramon.leon at allresnet.com
Mon Mar 3 20:31:42 UTC 2008


> Lost but not in an island.
> i have this problem: If i want to access the seaside session 
> inside de forWork block will answer nil, e.g:
> 
>     html div id: 'id1';    
>         with: 'Opening...'
>         waitMax: 30 seconds 
>         forWork: [ self session inspect halt. (Delay 
> forSeconds: 10) wait. ] 
>         thenRender:[:r :value | r text: value]
> 
> the inspector shows nil.
> what could be happening here?
> 
> i've followed the message chain over the WATagBrush down to 
> this method in BlockContext and BlockClosure 
> 
> valueWithing: onTimeout
> 
> but i cannot figure out from there how can i fix this one. 
> 
> regards

Seaside sessions use dynamic variables, which fail as soon as you fork.  A
quick fix is to put this in your base component class...

session
	"this seems dumb, but sometimes the dynamic var that holds the
session is unexpectedly unavailable, like when forking a thread, this
ensures I can always access it"
	^ session ifNil: [ session := WACurrentSession value ]

Then on first session access, the dynamic var is copied into a local
instance var that will be available no matter what, like during a fork.

Ramon Leon
http://onsmalltalk.com



More information about the seaside mailing list