[Zope-dev] Create Virtual DataSkin

Phillip J. Eby pje@telecommunity.com
Mon, 27 Nov 2000 21:15:54 -0500


At 08:34 PM 11/27/00 -0500, bentzion@bellatlantic.net wrote:
>Thanks Phillip. Is there a way to pass my REQUEST info to the ADD 
>Trigger? 
>
>I am under the impression that only "self" and some other ZPattern 
>specific properties are available to the trigger.

You also have access to everything in the acquisition hierarchy of the
trigger or SkinScript method itself, which of course includes REQUEST.  So
either REQUEST (which would look it up in the trigger's acquisition
hierarchy) or self.REQUEST (which would look it up in the DataSkin's
acquisition hierarchy) should work fine.

Now that I've told you *how* to get at it, however, I should warn against
making too much use of the request to get information that
could've/should've been passed to the DataSkin by application or domain
code.  It makes sense to use the request if you want to log things about
the request that caused the change, but it's probably not a good idea to be
looking at form fields and such, since that would introduce an undesirable
coupling between your application structure and your triggers.  Ideally,
triggers should only look to the DataSkin for anything other than methods
or constants they need to carry out their job.  In practice of course, if
you want to do something like log the AUTHENTICATED_USER and whether they
were logged in via SSL, then of course the REQUEST is the right way to do it.