[Zope] Data-Aware Folder

Igor Elbert ielbert@genuone.com
Mon, 22 Jul 2002 07:56:18 -0400

I am a fairly new to Zope so I apologize for my naiveté. I have a need for
the Data-Aware Folder product described below. I did not find any existing
product that implements such functionality. I decided to run an idea past
the Zope community to see if it makes sense and if anything like that has
been already developed. I appreciate any feedback.

If all our data is stored in ZODB then I can say, for example,
http://localhost/Org/ENRON/Address/get and get a list of all addresses for
ENRON (billing, shipping, etc).
http://localhost/Org/ENRON/Contact/Smith/Address/get would give me an
address of Smith from ENRON.

Everything is pretty easy. We can manipulate our data via ZMI or build
custom GUI to do it. We can use Zope's features like an access-control,
cataloging, etc.

Now let's say that some data is stored in DBMS or other place outside the
ZODB. We know how to get it (e.g. ZSQL) but Zope mechanics would not work
anymore. I would have to say http://localhost/Org/Address/get?org_id=ENRON
or http://localhost/Org/Contact/Address/get?org_id=ENRON&contact_id=Smith
since "ENRON" and "Smith" are now just the values in the database. Which is
not bad except I loose many of Zope's nice features: acquisition for once.

It would be nice to have a 'Data-Aware Folder' that gets its content from
both Zope and an outside source and merges them together. This folder would
call a 'getter' method to get a list of objects. Then it would see if it
contains some 'RecordFolders' and merges objects data from the list with
information from the RecordFolder. This way I would be able to create a
RecordFolder "ENRON" put an ENRON logo there (or a permission folder, or
anything else) and the data-aware folder will get additional ENRON
information (if needed) from the DBMS and mix it with the information stored
in Zope.

For example, I need to display information about a company with it's
addresses and a list of contacts from the database. I have a ZPT in
http://localhost/Org to do that. For ENRON I would like to display the same
information but arranged differently (with "WATCH OUT!" signs all over). It
would be logical to create a Folder ENRON with a specific ZPT in it that
handles the difference. So now http://localhost/Org/ENRON looks different
from http://localhost/Org/ACME where both ENRON and ACME come from the

The first step would be to correctly resolve paths like
http://Org/ENRON/Contact/Smith/Address which may involve calling
Org.get(org_id=ENRON).Contact(contact_id=Smith).Address or
Org.Contact.Address(org_id=ENRON, contact_id=Smith) depending on situation.

The next step would be merging records returned by the "getter" with the
folder context so I can say http://Org/ENRON/Contact/Smith/picture and
obtain either picture of Smith (stored in Zope in Contact/Smith) or a
placeholder picture from Contact.

So my question is: does a Data-Aware Folder idea make sense or I overlooked
some Zopish way to address the described issues?