I am trying to make a folderish ObjectManager that can display items that exist inside it (in ZODB) as well as some items in a db. I would like the database items to appears as if they exist in the folder. Most of this is for the manage interface. I created a Product that extends ObjectManager. Should I just override objectItems and objectIds? But I am worried about how to handle the _getObj method. Any suggestions? Chris
Chris Bruce wrote at 2004-2-27 15:55 -0800:
I am trying to make a folderish ObjectManager that can display items that exist inside it (in ZODB) as well as some items in a db. I would like the database items to appears as if they exist in the folder. Most of this is for the manage interface. I created a Product that extends ObjectManager.
Should I just override objectItems and objectIds?
When you want to use the standard ZMI, you will need to override the "object*" methods.
But I am worried about how to handle the _getObj method.
Look at how "Z SQL Methods" wrap database records into custom classes (maybe called "brains"). Do something similar in your "_getOb". -- Dieter
Chris Bruce wrote:
I am trying to make a folderish ObjectManager that can display items that exist inside it (in ZODB) as well as some items in a db. I would like the database items to appears as if they exist in the folder. Most of this is for the manage interface. I created a Product that extends ObjectManager.
Should I just override objectItems and objectIds? But I am worried about how to handle the _getObj method.
I think that a better approach would be to handle it in the level below the objectmanager. Ie. write a product that saves itself as an object in the zodb, and then gets its persistent values from the database. Ie. if you save the sql rows key in the Zope object, you could get the row from that key, and then get the column values and save them in volatile attributes. (starting with '_v_') Meaning that one object is one row. That way it would act just like an ordinary zope product, and can be catalogued etc. in Zope. regards Max M
participants (3)
-
Chris Bruce -
Dieter Maurer -
Max M