[Zope-dev] FW: ZPatterns, ObjectDomain, UML and all that.....

Phillip J. Eby pje@telecommunity.com
Tue, 05 Dec 2000 15:56:41 -0500


At 09:44 PM 12/5/00 +0200, Roch'e Compaan wrote:
>> If you want to store one DataSkin inside another, where either one of them
>> is stored in a Rack, you will have to create appropriate SkinScript or
>> custom attribute providers to do so.
>
>But what if I always store dataskins in there own racks but simply assign
an attribute of one 
>Dataskin to the instance of another Dataskin?  I simply want to be able to
say 
>Customer.Address.Street...
>

As implied above, you cannot, unless you do so with an appropriate
provider.  Just like ZODB-stored objects, ZPatterns objects cannot function
if you break the rules that govern their behavior.  (E.g. if you change a
mutable value of a ZODB object, it has no way to know it should be saved to
the database.)  This is a "by design" limitation of ZPatterns.  Also, it's
not that bad of a limitation.  You can easily work around it with
SkinScript or an attribute provider, and more commonly, this is done by
delegation to another specialist.

Specifically, rather than breaking encapsulation by having application code
write to an attribute directly, you use a method which delegates to the
foreign specialist, asking it to link or create an associated object.  You
can then still use SkinScript to retrieve your "Address" attribute, again
by delegation to the other Specialist.