Phillip Pearson - web + electronics notes

tech notes and web hackery from a new zealander who was vaguely useful on the web back in 2002 (see: python community server, the blogging ecosystem, the new zealand coffee review, the internet topic exchange).


bzero 0.17 released

OK guys, bzero 0.17 is here. Get it from the usual place!

Lots of stuff has happened since 0.16; here's the bit from the changelog:

* Added another troubleshooting note to the docs, and added python2.2-xmlbase to the list of Debian packages to install.

* b0lib/ added to distribution. (Oops.)

* Added more newlines to the end of template files, to make Doug Landauer happy.

* Changed URL for Second p0st in the default blogroll and docs.

* Now you can put an 'upstreamFolderUrl' attribute under the <blog/> element in auth.xml and have bzero use that to generate permalinks. This means you can use rsync or ftp or something to store your blog on a normal web server and also upstream to a community server, without having to have permalinks generated by the community server.

* Changed RSS template to not put in real e-mail addresses (because I've been getting _far_ too much spam from my Radio and bzero RSS files!)

* Added 'sendsearch' command-line option, to send post information for the whole blog to a search engine.

* Added 'fsdump' command-line option, to dump out a blog into a format that hopefully anybody can read.

* Added 'recent' command-line option, to list filenames of recent posts (to make it easy to edit them).

* Added 'editroll' command-line option, to bring up in the editor.

... more like this: [] ... topic exchange: []

k-collector backend

A tip from Matt Mower (via email): the k-collector topic roll lets you get at all the topic information on the server.

(It also has info on an XML-RPC ping endpoint that I guess is the key to getting your blog included in the WWWW directory).

A quick hack on the Topic Exchange code lets it dump out its topic list in the same format. No idea how useful that is, but I guess another output format can't hurt ;-)

... more like this: [, ]

Handling dates and times in Python

One of the tricks to programming effectively Python is knowing where all the date and time functions are. Every now and then I find another one that I didn't know existed. Today I found that the email.Utils package has parsedate and formatdate methods that respectively parse and generate RFC-2822 dates to and from Python time tuples.

Previously I'd been using mxDateTime (which does everything but requires a C extension) to parse e-mail style dates (i.e. the ones used in RSS and changes.xml) but it looks like they're handled by the standard library.

Here's a quick summary of the date-handling functions I know about so far:

Unix timestamps and time tuples


   time - returns the time as a Unix timestamp

   gmtime - turns a Unix timestamp into a time tuple w.r.t. GMT

   localtime turns a Unix timestamp into a time tuple w.r.t. the local timezone

   mktime - turns a time tuple w.r.t. the local timezone into a Unix timestamp


   timegm - turns a time tuple w.r.t. GMT into a Unix timestamp

Text formats


   asctime - turns a time tuple into some random text format

   ctime - turns a Unix timestamp into a weird stringified time


   parsedate - turns an RFC-2822 date into a time tuple

   formatdate - turns a time tuple into an RFC-2822 date
... more like this: [] ... topic exchange: []