Yow, the whitespace in my last message was seriously messed up.  Let me
try again.

Adam Groszer wrote:
> I'm using something like this:
> def getCurrentRequest():
>     return getInteraction().participations[0]

It is, of course, better if you can structure your app so you don't have
to pull the request "out of thin air", but if you do, I'd be a little
more careful about it.  Like so:

def getRequest():
     i = zope.security.management.getInteraction()

     for p in i.participations:
         if IRequest.providedBy(p):
             return p

     raise RuntimeError('Could not find current request.')
Benji York
Senior Software Engineer
Zope Corporation
Zope3-users mailing list

Reply via email to