[ZPatterns] Re: [Zope3-dev] Associations
Steve Spicklemire
[email protected]
Tue, 29 Jan 2002 13:45:33 -0500
OK.. based on the email from Zope-3 I decided to try the following:
class DataSkinProxy(DataSkins.DataSkin):
meta_type='DataSkin Proxy'
def __of__(self,parent,....):
... this is a clone of DataSkin.__of__() except that it does:
try: _gdmf = parent.aq_acquire('getDataManagerFor')
except: pass
else: dm = _gdmf(new_self, dm)
Then.. I made a Python Script "getDataManagerFor" in a folder that
returned a Rack. Now when I access attributes of objects that subclass
from DataSkinProxy they call "getDataManagerFor" and use the returned
Rack as their DataManager. ;-) That was easy!
Is there a way to accomplish this without subclassing DataSkin?
thanks,'
-steve
On 1/29/02 7:18 AM, "Steve Spicklemire" <[email protected]> wrote:
Hi Phillip!
Yes.. except a "standard" DataSkin needs either a Rack or a Folder
w/Customizer Support to act as a data manager. It would be nice if the
application could provide a service "getDataManagerForType" so that
standard DataSkins could be created anywhere, e.g., in a "default" CMF,
without needing to do anything special, other than implement
"getDataManagerForType" which could easily return a Rack. Hmm... could I
just subclass DataSkin and implement __of__ to call an acquired
getDataManagerForType to set the DataSkin's _v_dm_?