[Zope] Can Zope generate HTML files in a "batch" mode?

Amos Latteier amos@aracnet.com
Tue, 03 Aug 1999 19:44:52 -0700


At 12:16 PM 8/4/99 +1000, you wrote:
>Hi all,
>
>Can Zope be used as a static HTML page generator?  
>
>I mean for example, to generate all the pages for a given site
>(along with any images etc)  and write them all to a directory 
>structure for later use?

Of course!

Zope is focused on dynamic content generation, but there's nothing stopping
you from taking a snapshot of your dynamic objects and doing whatever you
please with it.

Many folks have recommended using a webcrawler to grab your web pages.

Another approach is to use an external method to write certain objects to
disk.

Here's a *totally untested* external method for the later approach. (This
is off the top of my head, it's just to give you an idea of how you might
do this kind of thing.)

import os

def dump_to_disk(self, directory, REQUEST)
    """
    Recursively dumps Zope objects to disk.
    """
    for id, object in self.objectItems():
        path=os.path.join(directory, id)
        if object.meta_type=='Folder':
            os.mkdir(path)
            object.dump_to_disk(path, REQUEST)
        elif object.meta_type in ('DTML Document', 'DTML Method'):
            open(path, 'wb').write(object(object, REQUEST))
        elif object.meta_type in ('Image', 'File'):
            open(path, 'wb').write(object.data)  

Good luck!

-Amos