+ Oleg Broytman's Personal Site
About making the site The site was, is and always will be maintained and hosted using only free software. Current winners are: Linux and FreeBSD operating systems, web-server Apache, vim editor, Python programming language, CheetahTemplate. The site is static. I thought about making it using wiki or blog software, but decided not to go that way. I mostly don't like those "personal journal" s ites, I don't like to publish small notes every few days. I prefer to put text infrequently and I prefer to choose the format for an every file separately, depending on the file. Also there is a number of mirrors of the site, and those mirrors are static. So I decided to make it completely static. Initially, when I started to create the site back in 1994, I edited every file by hands - just copied a template that included all HTML blurb and filled it with content. Later I decided to really use templates to generate HTML files - so I need only to provide contents, and templates will do the rest. In the middle of 2004 I started to experiment with different template systems and scripts to generate the site. My first attempt was to use ht2html, a program which is used to generate Python and related sites. The attempt was partially successful - I converted all static HTML files to templates, and wrote a number of scripts to generate the site. Also I wrote a code that converted text files to HTML, maki ng URLs real links (hrefs), similar to what wikies do. The failure was that ht2html required patching to suite my needs, and those patches were not accepted by the authors (well, I must admit they were no rejected either). It is understandable - they are Python core developers, and are very busy with their jobs. But I didn't want to rely upon a program that I constantly need to patch. So in the beginning of 2005 I decided to find an alternative. I looked here and there and finally came to CheetahTemplate. I've already thought about usi ng CheetahTemplate for other projects, so I decided to give it a try. Converting ht2html templates to Cheetah was not a big task. A simple script did it in a minute. Then I developed a framework to generate the site. The fr amework is rather simple. The CheetahTemplate compiles templates to Python modules and classes, so the language in a template is as powerful as Python itself - not only there are loops and conditional clauses, but also inheritance! I created a Python class phd_pp.py, that serves as the base class for all my templates. The class contains base code that I prefer to write in pure Python. In particular, there is the code preserved from previous version of the site that converts text to HTML. Please be warned that the file contains code borrowed from ZWiki and thus is protected by GPL. All other modules and scripts here are free - you can do w hatever you want, just don't blame me. Then there is phd_pp_ru.tmpl, a template that inherits phd_pp class, initializes a lot of common variables (title, description, and so on) to default val ues (usually None). Any particular template on the site being a descendant of phd_pp_ru.tmpl, can redefine these values. The base template inclu des all necessary HTML, so any descendant should only provide a title and a body in text or HTML format. And finally there are a number of scripts to do the real work. make-files checks if phd_pp_ru.tmpl needs to be compiled (does phd_pp_ru.py exist? is it n ewer than template?), compiles it, and fills all templates listed on the command line. make-changed lists all *.tmpl files on the site. The companion program make-changed.py scans the list, compares template and HTML modification times, fil ters those that do not require updating and lists modified templates. Then make-changed runs make-files over the list of modified templates. Jus t so simple, really! The site is being generated using these scripts on my home computer and synchronized with phd.pp.ru using rsync. From that server it is uploaded to mirro rs using sitecopy.