Re: [Zope-dev] Adding and setting properties from a virtualSpecialist

2000-12-13 Thread Itai Tavor

Steve Spicklemire wrote:

Hi Itai,

  "Itai" == Itai Tavor [EMAIL PROTECTED] writes:

 Itai "OrderingEntities.getItem(some_id).current_order_id)" shows
 Itai me the value of current_order_id of the Employee object
 Itai some_id. But I can't figure out how to change the property
 Itai so it get changed in the Employee object. dtml-call
 Itai 
"OrderingEntities.getItem(some_id).manage_changeProperties(current_order_id='123')"
 Itai does nothing, it doesn't even trigger the WHEN OBJECT
 Itai CHANGED line (not that I really expected it to work... this
 Itai object is virtual, how can I call changeProperties on it?)

How about 
'OrderingEntities.getItem(some_id).propertysheets.TheRightPropertysheet.manage_changeProperties()

Gr now I'm really annoyed. Why didn't I try that? So obvious. Thanks.


 Itai Other than figuring out how to get the change to work, I two
 Itai more problems:

 Itai -Eventually the OrderingEntities Specialist will have
 Itai several Racks mapping to several other Specialists, so it
 Itai will end up returning different classes. Should I instead
 Itai create a new ZClass with just the current_order_id property
 Itai and use this class in all the virtual Racks?

This is what I do in most cases... each rack has different SkinScript
to map the attributes of different classes onto the common attribute
set of the single Storage class used by all the racks.

Sounds like a good plan, think I'll adopt it.


 Itai - How do I add a property to the original object from the
 Itai virtual object (assuming I did not add it manually to the
 Itai Employee class)? Do I call
 Itai self.original_object.manage_addProperty(...) from the
 Itai SkinScript?

I think this should work  but it will only add the propertysheet
to the instance.. not the class. If the property is completely missing
from the original class then it seems to me either there is really no
real need to save it there... or the class was incomplete somehow to
begin with... and it should be added at the ZClass level..

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


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

Itai
-- 
Itai Tavor"Je sautille, donc je suis."
C3Works[EMAIL PROTECTED]  - Kermit the Frog

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


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




Re: [Zope-dev] Adding and setting properties from a virtualSpecialist

2000-12-13 Thread Steve Spicklemire


Hi Itai,

 "Itai" == Itai Tavor [EMAIL PROTECTED] 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 [EMAIL PROTECTED] - Kermit the Frog

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


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )