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

Rupert Redington rupert at neontribe.co.uk
Wed Jun 21 10:57:01 EDT 2006


Philipp von Weitershausen wrote:

> 
> That already sounds like bad design. Why would the local utility worry
> about URLs at all?
> 

It probably is :-)

The utility is responsible for generating a PDF snapshot of a view - as
seen by the invoking user at the point when the utility is invoked. To
do this I open an HTMLDOC subprocess which needs a url to go to, and
which needs to know which user to pretend to be so that it can
authenticate... This is indeed all very ugly, but I needed it done and
couldn't think of a better way at the time.

I can't help feeling that to say that a utility should never ever
concern itself with URLs is unnecessarily restrictive.


> 
>> Furthermore I sometimes find myself using this in event subscribers - I
>> can't see any way to get request data from an event...
> 
> Why would you want to? If you really want to use events, throw an event
> that also holds on to the request. I still think that this wouldn't be
> necessary in most cases.

I sometimes send out an email from an event handler and
getInteraction().participations[0].principal.title is a convenient way
to tell the recipient of the mail who it was that initiated the
change... (from John's post I begin to understand that I might find the
actors details stored in an annotation (if its an annotatable content
object thats been altered))

Rupert (who clearly doesn't 'get' some things yet...)


More information about the Zope3-users mailing list