[Zope] OFS object attributes from a SQL DB? (ZPatterns)
ra@burningman.com
ra@burningman.com
Tue, 05 Feb 2002 17:11:39 -0800
responding to myself here, for posterity's sake...
It turns out I _was_ on the right track... my ZClass needed to inherit
from both DataSkin and from ZFolder. But, for some reason, if I put
ZFolder BEFORE DataSkin in the superclass list, then I get the error I
mentioned below. If, however, I put DataSkin before ZFolder, I can add
my ZClasses exactly as I would expect.
Once I overcame this hurdle, then the pieces fell together. I created a
"Folder w/ Customizer Support". Then I created a Customizer in this
folder, and I linked it to my new object type. I added a ZSQL Method to
the Customizer to extract the data that I wanted from the db, and then I
added a SkinScript in the Customizer's "Data Plug-Ins" tab to expose
this data.
Now I can add DTML Methods in my ZClass that refer to these attributes
and the correct data (from the SQL database) is being displayed. Hooray!
hope-it-helps-someone-else-down-the-road'ly yours,
-r
ra@burningman.com wrote:
> Hi all,
>
> I'm trying to create a Folder-ish ZClass that has certain attributes
> which are actually linked to data that lives in a SQL database. I know
> I could just use methods to access the data, but I'm trying to gain some
> ZPatterns foo, and it seems to me that I should be able to get this data
> to be exposed exactly as though it were just a regular attribute on a
> PropertySheet. I'm having a hard time finding the magic combination,
> though...
>
> As I understand ZPatterns, these folder objects should be DataSkins,
> with DataManagers that would fetch and store the data where appropriate.
> However, if I try to create a ZClass with both OFS:Folder and
> ZPatterns:DataSkin as base classes, whenever I try to add it somewhere I
> get a Key Error for "_v_dm_".
>
> Can anyone help me discover the "right" way to use ZPatterns to make a
> persistent Object File System type of object transparently mingle
> attributes from PropertySheets, SQL Methods, etc.? I know that I'm
> close... I just can't quite wrap my head around it...
>
> Thanks,
>
> -r