[Zope] "virtual" subobjects

Kent Polk kent@goathill.org
6 Aug 1999 17:17:21 GMT


On 6 Aug 1999 02:20:00 -0500, Amos Latteier wrote:
>At 12:54 PM 8/6/99 +1000, Tim Potter wrote:
>>I'm grappling with the idea of having "virtual folders" (for want of a

>The Zope ORB will publish sub-objects by using getattr and getitem by
>default, but you can control its traversal process manually with the
>__bobo_traverse__ hook.

I am currently developing a product which publishes objects based
on information stored in filesystems.  It creates two classes of
folderish objects, an extended 'Directory Folder' and a 'Database
Folder'.

The Directory folder is simply a Zope Folder class which attempts
to locate interesting objects and attributes contained within the
filesystem subdirectory (recursively). It instantiates a Directory
Folder in the Zope database for each subdirectory it encounters as
it walks the specified directory tree. The folder instantiation is
done to allow one to place other Zope components in each folder.

The Database Folder is a virtual object instantiated in the Zope
database as a folderish object which knows how to locate and make
available application-specific 'database tables', CSV tables,
HTML/DTML files which are treated as instance methods and which
are not instantiated in the Zope database, but are entirely virtual
objects. Also instantiated in the Zope database in order to allow
other Zope components.

The database and CSV table handling is done by a new set of TinyTables
Classes which Ty wrote to implement the Data Mining capabilities
posted about a month or so ago. The new Table Mining Class implements
a subMine class which is instantiated each time a Table is 'mined'
and is managed by URL component.

So there's a lot of virtual stuff going on here. We make extensive
use of __bobo_traverse__ and __getattr__ in all of this stuff to
either try to watch for changes in the filesystem objects or to
navigate virtual methods and objects.  For the most part, it works
great.  However, as I mentioned in Zope.dev, I've having a little
bit of trouble with  __bobo_traverse retaining variable values from
one call (GET) to the next.

I have included a Test Folder object which shows the problems and
possibly shows what I need to have saved (it does not implement
the directory class stuff). I need the bobo_traverse (or something
like it) that allows me to automatically check the status of objects
before they are rendered. Bobo_traverse does exactly what I need,
with the exception that I need '_v_variable' value changes to be
retained during the zope session.

Sure would appreciate some helpful suggestions. If I could figure
out how to deal with this problem, I could release an example
virtual folder filesystem-mapping product for you guys to play
with.

Thanks
Kent

begin 644 Test.tgz
M'XL("+D!JS<``U1E<W0N=&%R`.U8:V_B2!;-U_A77)&)@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