[Seaside] Where to store db connection value?

Chad Nantais chad at clearwaterassociates.ca
Wed Oct 19 17:36:07 UTC 2005


Thanks for the hint.

Using the method you suggested, how would I setup the database
connection in a unit TestCase that is obviously not in the context of
a Seaside component?

Chad

On 10/19/05, Bany, Michel <mbany at cincom.com> wrote:
> I use this technique by subclassing #responseForRequest:
> This works very well.
> Michel.
>
>
>
> > -----Original Message-----
> > From: seaside-bounces at lists.squeakfoundation.org
> > [mailto:seaside-bounces at lists.squeakfoundation.org] On Behalf
> > Of Julian Fitzell
> > Sent: Wednesday, October 19, 2005 7:04 PM
> > To: The Squeak Enterprise Aubergines Server - general discussion.
> > Subject: Re: [Seaside] Where to store db connection value?
> >
> > Well, certainly not the only way but one option is to use
> > WADynamicVariable:
> >
> > Create a subclass of WADynamicVariable (say MYCurrentDatabase)
> >
> > Then, in your session (maybe in #performRequest: - can't
> > remember exactly where the best place to plug in is and I'm
> > at work at the moment), you do something like:
> >
> > performRequest: aRequest
> >       ^ MYCurrentDatabase use: self database during: [super
> > performRequest:
> > aRequest]
> >
> > Now you can access the database from anywhere (during request
> > handling) by doing "MYCurrentDatabase value".  You could even add:
> >
> > Object>>currentDatabase
> >     ^ MYCurrentDatabase value
> >
> > to make things cleaner.
> >
> > You might need to tweak that a bit; as I said, I can't quite
> > remember the best place to plug it in (and I was doing it
> > most recently with Seaside 2.3 anyway) but you can look at
> > how WACurrentSession does it because it's doing pretty much
> > the same thing.
> >
> > Hope that's helpful,
> >
> > Julian
> >
> > Chad Nantais wrote:
> > > My application is composed of Models and Views (Seaside
> > Components).
> > > The models (rather than the views) need to access the data I have
> > > stored in a dictionary object.  I have multiple data stores
> > > ('development' and 'testing').  I have added a session
> > configuration
> > > variable (dataStoreName) in a subclass of
> > WASessionConfiguration that
> > > holds the name of the data store I want to use (eg.
> > 'testing' for unit
> > > tests). However, since the models subclass Object and are not
> > > sublasses of WAComponent, I can't get them to access the value of
> > > MYSessionConfiguration>>dataStoreName
> > >
> > > How can I give my models access to the value of
> > dataStoreName so they
> > > can access data from the configured dataStore?
> > >
> > > Chad
> > >
> > > --
> > > Chad Nantais, CISSP
> > >
> > > "Let him who would move the world first move himself." --Socrates
> > > _______________________________________________
> > > Seaside mailing list
> > > Seaside at lists.squeakfoundation.org
> > > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> > _______________________________________________
> > Seaside mailing list
> > Seaside at lists.squeakfoundation.org
> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> >
> _______________________________________________
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>


--
Chad Nantais, CISSP

"Let him who would move the world first move himself." --Socrates


More information about the Seaside mailing list