[Zope] [ZGotW] Issue #2 (Closed)

Zope Guru of the Week ZGotW@palladion.com
Thu, 03 Feb 2000 13:39:31 US/Pacific


The current issue of "Zope Guru of the Week" has closed:

===================================================================
Issue #2 -- How to Import a Static Web Site into Zope
===================================================================

       Status:  Closed 

    Zen Level:  Novice (1/8)

     Keywords:  Management Interface 

 Submitted by:  ithomas christmas@mail.sd70.bc.ca
-------------------------------------------------------------------
 How can one most easily (with the least typing) import an 
 existing static website into Zope?  The site contains:

  * image files

  * multiple HTML/JavaScript files including internal 
    and external links 

 After doing it by hand for a small site I decided there had to 
 be better way.  
-------------------------------------------------------------------

  Reviewed by:  Tres Seaver tseaver@palladion.com
-------------------------------------------------------------------
Summary

 I'm going to close this one out without a "perfect" answer.

  * K.S. Lee's "highly compressed" reply is essentially correct:
    the load_site.py script does a decent job of loading "static"
    content into a Zope server *from the local hard drive*.

  * The original question specifically called out issues with
    images and with JavaScript and external/internal links. Pam
    Crosby reports loading images successfully with load_site;
    Pam also notes difficulty with loading "compressed"
    files.

  Full points to both of them.

Issues Unresolved

 * load_site uses a very limited heuristic to detect the type
   of the file being loaded:  it uses the file extension to
   look up a handler function:

   - 'foo.jpg' loads as an image, as does 'foo.gif'

   - 'foo.jpeg' loads as a File object (ouch!)

   - 'foo.dtml' loads as a DTML Document

   - 'foo.html' gets loaded as a DTML Document with its 
      headers/footers stripped, id and title properties created
      from the headers, and gets a text property added, 
     'loadsite-head', containing the original headers;
     
   Probably the simplest way to address to add command line
   parameters to load_site to allow the user to override the
   heuristic, something like::

     python load_site -u zopemeister:zpass --image foo.jpeg --file bar.zip

 * I had difficulties trying to load images, but they could be
   due to pilot error and / or Netscape's stupid image caching.

 * load_site opens all files without passing the "mode"
   parameter, which could be gnarly on non-Unix platforms with
   binary files (this might explain my difficulties loading
   images, and Pam's with compressed files).
-------------------------------------------------------------------