[Zope-Annce] Enhanced load_site.py

Itamar Shtull-Trauring itamars@ibm.net
Sun, 13 Feb 2000 14:41:11 +0200


load_site.py lets you load files from the harddisk into Zope.  The version
included with Zope has a number of problems, however - it generates ugly
DTML and loses some information when importing HTML files using the -D
option.  My enhanced version fixes these problems, and also lets you fix the
"?" instead of "'" problem with Windows generated HTML.

You can download it at http://www.zope.org/Members/itamar/load_site/

I also have a version that matches the latest CVS version, but it's untested
so I didn't upload it - email me if you want it.



Changes to my version:

1. Generate Zope 2 style dtml - "<dtml-var standard_html_header>"
instead of <!--#var standard_html_header-->.

2. When using -D option:

   a. The contents of <head></head> is loaded to a property of the DTML
Document called loadsite_header instead of loadsite-header (Death to
_['stupid-var-name']!)

   b. the attributes of <body> (e.g bgcolor, text, onLoad) are stored in a
property called loadsite_bodyattribs.

3. Added -j option which strips Javascript from <head> when using the -D
option.  Why should you want this? If you use Dreamweaver to create pages,
you take all the Javascripts it generates, put them in one file - dw.js,
   add a <javascript src="/dw.js"></javascript> line to your
standard_header, and then strip all the Javascripts from the header.  That
way you don't have 200 copies of the same (broken) Javascript in all your
pages, just one.  Saves bandwith, saves time when you fix bugs.

4. Added -c option to clean up "curly quotes" generated by Windows apps like
Word which show up as '?' in Linux (and Macs?).
 

Here's an example standard_html_header for use with my load_site.py
(assuming you used the -D and -j option and stored all the javascripts your
pages use in /common.js):

<html>
<head><title><dtml-var title></title>
<dtml-var loadsite_header missing>
<javascript src="/common.js"></javascript>
</head>
<body <dtml-var loadsite_bodyattribs missing>>

--
Itamar S.-T., itamars@ibm.net