[Zope] Wrapping pre-existing content

J M Cerqueira Esteves jmce@artenumerica.com
Thu, 8 Mar 2001 13:05:07 +0000


On Thu, Mar 08, 2001 at 12:11:42PM -0000, Phil Harris wrote:
> The hierarchy is deep, wide and heavily populated at each node.  The number
> of folders is out of my control, as is the number of 'documents' in each
> folder, as is the type of documents.
> 
> I need a selective way of wrapping as well as all-encompassing way, e.g. I
> don't want to wrap Image or other binary types.

I haven't done it before, but I believe you could solve the problem with a
Python Script, using the Subpath binding.  If one of your documents is
for instance

 /foo/bar/documents/moo/miao/quack/ye_olde_document

and you have created your Python script in any other place, such as

 /zoo/wrapper

one would reach the wrapped version of the document via the URL

 http://your.place/zoo/wrapper/moo/miao/quack/ye_olde_document

thus invoking the `wrapper' script.

The `wrapper' script would simply have to use the traverse_subpath
variable in order to locate the document under /foo/bar/documents
(assuming all of those to be handled by `wrapper' are stored somewhere
below that folder), determine the document type, decide on how to wrap
it based on its type (and eventually other document properties if you
wish) and return the (conditionally) wrapped document (not forgetting to
set the appropriate Content-Type header).

Best regards
                                    JM