[Zope3-Users] Re: Access request object from content_factory

Philipp von Weitershausen philipp at weitershausen.de
Wed Jun 21 06:03:37 EDT 2006


Marco Mariani wrote:
> Rupert Redington wrote:
>> from zope.security.management import getInteraction
>>
>> request = getInteraction().participations[0]
>>
>> Why this works is outlined (IIRC) in zope/app/securitypolicy/zopepolicy.txt.
>>
>> There may well be better ways to fish for the request than this... any
>> offerings?
>>   
> In my understanding, if you need to look for the request inside a
> content object, you're doing something that should be done in another
> place, be it a view or an adapter.

Indeed.

> Of course, I've been wrong before :-]

Not this time :).

The hack displayed above (going thru the security interaction) should
not be considered a standard procedure for getting at the request in
places where you don't have it. Content objects are dull. They do
nothing. Other stuff does things *to* them. Mats' solution is the better
one.

Philipp



More information about the Zope3-users mailing list