[Zope3-Users] Getting request from subscriber ?
Hi, Probably a simple question... I need to extract request's content from an event handler defined via a subscriber. request doesn't seems to be in a subscriber's context. So how can I get it ?? Thanks, Thierry -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Getting request from subscriber ?
On Mon, 2006-02-13 at 12:02 +0100, Thierry FLORAC wrote: Hi, Probably a simple question... I need to extract request's content from an event handler defined via a subscriber. request doesn't seems to be in a subscriber's context. So how can I get it ?? Oops, Sorry ! I've already found the ZCML set_before_add instruction of addForm directive which perfectly handles my needs... Bye, Thierry -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Getting request from subscriber ?
On Feb 13, 2006, at 6:02 AM, Thierry FLORAC wrote: Hi, Probably a simple question... I need to extract request's content from an event handler defined via a subscriber. request doesn't seems to be in a subscriber's context. So how can I get it ?? option 1: make the subscriber listen for an event that has a request attribute (perhaps one you generate). option 2: see if there's another way to do what you want option 3: grab it by force from the thread locals--something like this: import zope.security.management from zope.publisher.interfaces import IRequest def getRequest(): i = zope.security.management.getInteraction() # raises NoInteraction for p in i.participations: if IRequest.providedBy(p): return p raise RuntimeError('No IRequest in interaction') Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users