[Zope-dev] Zope 2.5.0 Sessions & Testing

Chris Withers chrisw@nipltd.com
Tue, 08 Jan 2002 13:05:24 +0000


Chris McDonough wrote:
> 
> Your problem is that a REQUEST is not created without the
> publisher.  This is a particularly annoying and unsolved
> problem when doing tests.  

Is it solved in Zope 3?

> Your options are to use "import
> Zope; Zope.test('/some/method/name')" which has all sorts of
> bad side effects, 

Never even knew that existed. Where's it documented? What does it do? What are
the side effects?

> or to dummy up the environment as much as
> possible via things like makerequest, etc. enough for the
> method to work.  I can't say exactly what's needed for that
> in this case, I'd need to mess with it endlessly (luckily
> that's your job in this case ;-)

Well, we're using makerequest, and the following code seems to be keeping the
SESSION stuff working:

session = app.unrestrictedTraverse('/session_data_manager').getSessionData
app.REQUEST.set_lazy('SESSION', session)

Is that the 'right thing' to do?

cheers,

Chris