I am the author of the CVSFile product, available at 

I am thinking about implementing a new design, and wanted to get some
feedback from the list first (perhaps others have tried this approach?)

Here is a description of our problem:

ExternalFile is a Zope product that behaves like a 
DTMLDocument/method/etc but points
to a file outside of ZODB for its content (sort of like a symbolic link)

CVSFile inherits from ExternalFile, where the content file is stored in 
a CVS sandbox.
It features buttons to do updates, commits, etc.

So far, so good.  The problem is that we are working on a third Zope 
product whose instances
represent XML documents that automatically render themselves to HTML (or 
whatever) when
referred to.  You edit the XML content using ZMI or whatever, but when 
you navigate there,
you see the resulting web page/PDF/etc.  We are going to call it 
something along the lines of XSLTFile
because it uses XSLT to do the conversion.

Here's the issue:  the XML file that is the source of the transformation 
may or may not reside inside
the ZODB.   For example, we store most of our XML documents in CVS.   
 But if revision control is not
important (such as for one-off or throw-away documents) we keep them in 

How did we do this?  Well we had XSLTFile inherit from CVSFile.     This 
is bad.   What happens
when we switch to some other revision control tool (like clearcase, 
subversion, sourcesafe)?  Either you
have multiple classes like "CVS-XSLTFile, Clearcase-XSLTFile, etc." or a 
single class that knows
about every possible version control system.   yuk.   Clearly, 
inheritance and mixins are not the answer.

Instead we want delegation.   How to do this?

One idea is to register a custom protocol handler with python, using 
See:  http://www.python.org/doc/current/lib/module-urllib2.html         

I am imagining the following.  a new XSLTFile instance is created, 
pointing to a URL for its
content.   Here are some examples of URLs:


In this way, the XSLTFile instance knows nothing about CVS or any other 
revision control system.
Instead, it only knows about a URL, and the CVS protocol handler would 
know about how to retrieve files
from CVS.   We could create our own scheme where a query parameter would 
specify the sandbox name
or something.

The Zope protocol handler idea is interesting, and I haven't thought 
this all the way through yet.
Could  <dtml-var blat>  be thought of as referring to "zope://blat" 
where the Zope protocol is the default
and therefore omitted?   The idea of unifying all object references 
through URIs is intriguing to me.
(for more info, see REpresentational State Transfer: 
http://conveyor.com/RESTwiki/moin.cgi )



Zope-Dev maillist  -  [EMAIL PROTECTED]
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope )

Reply via email to