Hi Norbert,
I had to figure this out too. It wasn't too bad since there is already a
hook for it.
Here is something you can try.
First make a subclass of Exception subclass: ExceptionGetSession
Then subclass WASession subclass: YOURWASession. Then add a method:
YOURWASession >> withErrorHandler: aBlock
^super withErrorHandler: [aBlock
on: ExceptionGetSession do: [:ex | ex resume: self]]
Then all you need to do is call
aSession := ExceptionGetSession signal.
Oh you also need to set the session on your application to YOURWASession.
app := (self registerAsApplication: self entryPointName)
preferenceAt: #sessionClass put: YOURWASession; ...
I also watched with interest the threadLocalVariables discussion on
squeak-dev, which may be a much better solution then running up the stack to
retrieve the session.
Hope that helps,
Ron Teitelbaum
President / Principal Software Engineer
US Medical Record Specialists
www.USMedRec.com
> From: Norbert Hartl
>
> Hi,
>
> I'm trying to get the session from a component which is
> set up by a SCComponentTestCase. After setting up the
> component with
>
> self newApplicationWithRootClass: MyTestComponent
> and
> self establishSession
>
> I expected to be able to get the session through
>
> self component session
>
> but this is always nil. Do you know any way of getting the
> session from the component?
>
> thanks,
>
> Norbert
>
> _______________________________________________
> Seaside mailing list
>
[hidden email]
>
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside