[Zope-dev] A couple of ZPatterns questions

Itai Tavor itai@OPTUSNET.COM.AU
Thu, 12 Oct 2000 18:15:23 +1100


Hi,

1. I want to set some object attributes every time the object is 
changed (for example, to store the name of the user making the 
change). I looked at using a Generic Trigger or a SkinScript but I 
can't figure how to do it with either one.

With a Trigger, I guess I need to set "Set Sttrs" to all the object 
attributes except the ones I intend to set (otherwise, would setting 
an attribute in the Trigger cause the Trigger to be called again?) 
and then call a method to set the attributes - but how do I set the 
attributes? Do I have to call changeProperties for the object or can 
I make the change directly on the DataSkin?

With SkinScript, I can't figure out the STORE and USING syntax... 
also, if I use WHEN OBJECT CHANGED to change the object, would I get 
infinite recursion? Can I evaluate REQUEST['AUTHENTICATED_USER'] in 
the SkinScript or do I need to call a method for that?


2. I want to store a list of products, and give each one an arbitrary 
number of photos. I can use a Product ZClass, subclassed from 
ObjectManager and store Image objects inside it. But what will happen 
to these objects if I use this ZClass in a Rack? And how would I 
handle storing the objects in SQL tables - I will need to somehow 
turn each Image object into a table entry, and the same Generic 
Attribute Provider will have to work with 2 SQL tables. Is there a 
nice way of doing this? Or should I store the photos in a separate 
ZClass and use it in another Rack in the Products Specialist?

Actually, I can't put an Image object on a DataSkin, right? So 
however I store it, it's going to have to be a my own custom Image 
object subclassed from DataSkin...


TIA, Itai
-- 
Itai Tavor                    "Je sautille, donc je suis."
C3Works    itai@c3works.com              - Kermit the Frog

"If you haven't got your health, you haven't got anything"