[Zope-dev] ZPatterns and Properties that are objects

Phillip J. Eby pje@telecommunity.com
Tue, 07 Nov 2000 10:29:07 -0500


At 01:01 PM 11/7/00 +0200, Roch'e Compaan wrote:
>
>I created a couple of ZClasses based on Dataskin.
>
>In the way I grok ZOPE, properties that are objects can not go onto property
>sheets.  So if I have a Customer ZClass that has a property Address (a
>property that is an object) then I would create the address object as a
>"method" of the Customer that makes references like Customer.Address.Street
>possible.

The way Ty and I usually handle "object" properties is to give an object
setter methods (e.g. "setAddress()") that simply set the property (e.g.
self.Address = addr).  The only downside is that you have to do this in a
Python base class or an External method.  Later, we expect to replace this
approach with PropertyHandlers, and we already have a primitive form of
PropertyHandler we have used with some success, but it's too crude at this
point for a product release.


>To achieve this without ZPatterns I would base my ZClass on a objectmanager
>so that I can create an instance of an Address object within Customer.  So
>how does one do this with ZPatterns.  In one posting I picked up that one
>does not have much joy with ZPatterns and the ObjectManger base class?

I have created ObjectManager and Folder dataskins before and had them work,
but at the time I was testing with Zope 2.1.6, and it was an older version
of ZPatterns.  I haven't done much lately with them.  If people are
experiencing problems, perhaps someone could send me a bug report?