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 = # raises NoInteraction

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