[Zope] Inserting an object automagically on folder creation

Nicolas Évrard nicoe@altern.org
Fri, 28 Feb 2003 01:15:47 +0100


Hello everyone, 

A long time ago I posted some question and finally made it to the
creation of my first product, now I'm back

I'm still thinking on how I will design my product but here are some
caracteristics I'd like my product to have

A) I'd like to create two way to represent data. In the first one the
data is stored in in ZODB, in the second one the data is stored in a
(possibly) remote database server.

So I intend to do it this way :

 - Zpeople
   `- ZpeopleItemContainer (inheriting from Folder)
   `- ZpeopleItem (inheriting from SimpleItem)
   `- ZpeopleSQL (any pointer on how I can do this)

I'd like ZpeopleSQL and ZpeopleItemContainer to have the same contract
(ie: a search method with different flavour of search).

Last but not least, 'a' being a ZpeopleSQL instance and 'b' being a
ZpeopleItemContainer instance. Is it possible through some clever use of
acquisition to acces the same kind of internal information by the same
kind of url ?

Example:
 localhost/folder/a/p1/name -> name of people whose id is p1 (DB version)
 localhost/folder/b/p1/name -> name of people whose id is p1 (ZODB version)

B) I'd like to insert on a Product creation three objects.

I use this code :

    def __init__(self, args) :
            self.clientsDB = ZpeopleSQL('clientsDB', dbConnection)
            self._setObject('clientsDB', self.clientsDB)

is it gonna work ?

Or maybe I should use this less elegant (at least IMHO) version :

self.manage_addProduct['ZpeopleSQL'].manage_addPT(id='dkfj', db=dbConnection)

Any help, flame, pointer appreciated ...

-- 
(°>  Nicolas Évrard
/ )  Liège - Belgique
^^