I use rest2web to maintain this website.

I use git to backup the source of this website and to be able to work on it from several machines. Unfortunately, that results in a problem (originally reported for svn) keeping the timestamps at the bottom of the pages the same when building on any of those machines. To solve this issue, I have the following at the start of my template.txt file. With this in place, I use <% my_timestamp %> (instead of <% modtime %>) to place the timestamp at the bottom of the pages.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><#
####### Import statements
import subprocess, tempfile, datetime, time
import xml.etree.ElementTree as ET
import pytz


def get_git_commit_time( path ):
    path=relpath(path)
    args = ['git','log','-1','--date=local',"--pretty=format:%at",path]
    fd = tempfile.TemporaryFile()
    subprocess.check_call(args,stdout=fd)
    fd.seek(0)
    buf = fd.read().strip()
    if not len(buf):
        return None
    timestamp = float(buf)
    return time.ctime(timestamp)

###### get modification time

# modtime_source may be set in uservalues to indicate an alternate
# file, but defaults to the page source.
if modtime_source is None or modtime_source=='None':
    modtime_source = source_file
else:
    orig_path = os.path.split(source_file)[0]
    modtime_source = os.path.join(orig_path, modtime_source)

my_timestamp = get_git_commit_time( modtime_source )

# XXX buglet: if modtime_source was not None, but git time was None,
# get the filesystem mtime of the modtime_source rather than using
# r2w's modtime variable.

if my_timestamp is None:
    my_timestamp = modtime


Page last modified Fri May 1 04:38:12 2009.