LeonMar says we should just open the file with an exclusive lock, rather than using a temporary file. That sounds nice and simple. NT implicitly locks the file against deletion but not against simultaneous modification when it's open for write. The fcntl locking mechanism doesn't seem to work, but perhaps there is a separate msvcrt routine which will do it.
Can we use the same strategy on Unix, or do we have to switch?
I think I have a portable posix locking Python module now, but I haven't tried it yet. — MartinPool
Clear up the few inconsistencies between normal and magic pages like RecentChanges. In OriginalWiki they do this by magic markup tags inside the pages, rather than by trapping the names. This is nice: amongst other things, it means that people can easily and consistently add documentation/explanation to those pages.
Don't put configuration options into the main script. (Perhaps instead put configuration into the CGI, then have it import the body of the program.)