[Zope-dev] Adding and setting properties from a virtual Specialist

Steve Spicklemire steve@spvi.com
Wed, 13 Dec 2000 21:00:48 -0500 (EST)


Hi Itai,

>>>>> "Itai" == Itai Tavor <itai@optusnet.com.au> writes:

    Itai> Say I got several Participants, and some of those need to be
    Itai> able to place orders. I create the Specialist
    Itai> OrderingEntities to implement the role of 'someone who
    Itai> places orders'. From what I understand about using
    Itai> Specialists to extend a class behavior, this Specialist
    Itai> should add the properties it needs to track orders with to
    Itai> the Participant classes - I should not have to go in to
    Itai> every Participant class and add the property to it, because
    Itai> those classes don't know and don't care that they might be
    Itai> used in this role. Am I wrong in this?  Otherwise, the only
    Itai> other way to track properties for this role would be to
    Itai> physically store a new object on the OrderingEntities Rack
    Itai> for every Participant class accessed, but what's the point
    Itai> in that, if I can simply add the property to the original
    Itai> class?

No.. you're right here. I've never used property sheets in this way,
just because it's seemed too much trouble to check for existence, then
add if necessary... etc. If I need to have a property set in an
instance... I just set it, using an external method. (Or I add it at
the ZClass level.) It's important to be careful though... if there is
already a property with that name.... there could be a clash. 
Obviously application integration needs to be done with full
awareness of the different attributes used by each component.

    Itai> Making small steps up the ZPatterns mountain (and too many
    Itai> of them backwards),

Yup.. me too. ;-) But it's better than sticks and bones..

take care,
-steve

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

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