Creating a static mirror of zope-pages
I modified the Script zope_static_mirror.py that can be found
here
in a way that it fits my needs. Just try out if it works for you.
I modified basically two things: First the adaption of the relative links works much better
now. In the original version the script included always the local directory in the path. This
way it was not possible to simply upload the pages in the main directory of a webserver.
The other thing I modified is that it writes index.html- instead of the zope-specific
index_html-files.
So how to use the script? Quite simple: First you have to install
Zope on your computer. Next you copy the source for
A_list out of the python-script and paste it in a python-script with the same name in
your root-directory.
After this you change to any directory you want and create there the subdirectory mirror.
Next you call the script from the command line: python zope_mirror_static.py.
Now you find a copy of your site in the subfoder mirror.
You can upload this page automatically e.g. with the tool Weex.
Mayeb you have to change some of the variables at the beginning of the script.
You can change the directory, the hostname, etc. But for a local server they should fit ... and
if you want to mirror you zope-internet-server I think you know how to modify a python-script. :)
Unfortunately I am not an experienced python-programmer and therefore I was not able
to manage the following problem: The script modifies the links in all files. This
changes the date of all files and even if they are not modified, they are uploaded
by weex.
To solve this problem, I wrote two perl-scripts: save_state.pl
and restore_dates.pl.
You have to run the first perl-script and then the python-script. If you execute then
the second perl-script, it compares the checksums of the files and resets those files
that are not changes to the old date. If someone integrates this functionality in the
python-script please give me a hint.
Download of the script
Download of th patche against the original file
|