[ZPatterns] FreeRangeDataSkins, was Re: [Zope3-dev] Associations
Steve Spicklemire
[email protected]
Tue, 29 Jan 2002 16:50:50 -0500
Hi ZPatterns folk,
OK.. I've changed the name... but it does seem to work pretty well. I've
called it a "FreeRangeDataSkin" ;-). Basically it called an acquired
object "getDataMangerFor" when it gets acquired. I've tested once by
returning a Rack and once using a Customizer, and both worked OK. The
nice thing is that you can store a FreeRangeDataSkin anywhere. They
can't be purely virtual as Rack Mounted data skins can, but they can
work in an existing CMF instance, for example. Anyway...
you can get it here:
http://webdev.zopeonarope.com/Misc/FreeRangeDS.tgz
-steve
On Tuesday, January 29, 2002, at 01:45 PM, Steve Spicklemire wrote:
>
> 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_?