Testing with Python 2.4 on Ubuntu 10.10

Recently I needed to test a Django app under Python 2.4. I’m using Ubuntu 10.10 and the lowest packaged version of Python in the repositories is 2.6. I decided to compile Python 2.4 myself and use it in a virtualenv environment to test the app. There were a couple of little gotchas that caught me when I was doing this, so I thought I’d write-up the process.

Step 1: Install the Build Dependencies

Python 2.6 is close enough to 2.4 that the dependencies haven’t changed much (if at all).
sudo apt-get build-dep python2.6

Step 2: Download Python 2.4 Final

wget http://www.python.org/ftp/python/2.4/Python-2.4.tgz
tar -zxvf Python-2.4.tgz

Step 3: Configure and Install Python 2.4

My first attempt at building Python 2.4 failed with a buffer overflow. I found a Japanese forum post that had solved the issue by setting BASECFLAGS=-U_FORTIFY_SOURCE during the configure stage.
sudo make install

Step 4: Fix the Default Python Version

The make install step sets Python 2.4 as the default version of Python. I wanted to keep that at 2.6. So…
sudo rm /usr/local/bin/python
sudo ln -s /usr/bin/python2.6 /usr/local/bin/python

Step 5: Install into Virtualenv

I wanted to set up a virtualenv environment to test the app. Here I specify which version of python I want to use for the interpreter and activate it.
virtualenv env -p python2.4 --no-site-packages
source env/bin/activate

Using Django FormWizard in a view

I recently needed to use a Django form wizard from a view. I needed it in a view as I had some permissions that I needed to check and also wanted to supply some initial data as the form would now be editing information that was previously supplied.

I had found some code on Django Snippets but it was also messing around with the way that form wizards were defined. I didn’t want to change the way that form wizards behaved so I stripped out the changes and was left with a minimal way to use a form wizard in a view.

The main thing to notice is that first you have to create an instance of the FormWizard. Then as the object to return from the view you must call the instance passing through the context and the request.


def edit_form_wizard(request, slug):
    # Do some permission checking
    ..... snip .....

    # Set up the dictionary of initial data for the form
    # In this case, we are pre-filling some data from the first form only
    initial = {0: {'first_name': request.user.first_name,
                   'last_name': request.user.last_name,
                   'email': request.user.email,

    # Create the form wizard
    form = EditFormWizard([ContactForm, SecondForm, ThirdForm], initial=initial)

    # Call the form wizard passing through the context and the request
    return form(context=RequestContext(request), request=request)

Moving from Slicehost to Linode

Spent the weekend moving HairCrazy from Slicehost to Linode.

A few times over the past year and a bit, we’ve had issues with high steal times on Slicehost, with the only cure being to move to another host server (and about an hour of downtime). The disk latency also had got worse, and we kept bumping up against the memory limits.

After a while discussing it, we finally decided to move to Linode for the following reasons:

  • London based data center. Which is handy, as most of our customers are this side of the Atlantic. And we like giving our customers a snappy response
  • Twice the memory for the same price.
  • So far, the steal time has been at 0% and iowait time has been low too.
  • The admin console is a bit more comprehensive too, but that wasn’t a reason for picking Linode

So far, things seems fine but I’ll keep an eye on it and report back if I have any issues.

New Laser printer

Jude’s old laser printer started chewing up paper, and she needed a new one. We looked around and found a colour networked laser printer for under £150! After reading as many reviews as we could, we went for the Xerox Phaser 6125.

The hardest bit about setting it up was getting it out of the box! It weighs 17.2kg and is the size of a small fridge.

Setting it up is easy. After removing a bunch of tabs, just plug-in the network cable and set the IP addresses that are allowed to print. It works fine from OSX, Ubuntu and XP.


I’ve been thinking about buying a laptop or a netbook recently. I like the idea of a netbook but was a bit worried that it would be too small, crappy and underpowered.

Today I got to play with David’s Samsung N130 running Ubuntu 10.10.

It’s nice. It’s no slower for doing the day to day things I need to do than the laptop I use at work (although that’s not saying much).

I think my mind is made up now… I’ll see if I can find a nice refurbished netbook.

Of Fonts and Typography

Recently, I wanted to use some nice @font-face on a website. When I was looking around I stumbled on Font Squirrel’s generator that packages up the fonts for you nicely, and auto-generates the proper CSS for their use. Nice.

I also came across The Elements of Typographic Style Applied to the Web (via Aza Raskin’s blog). It has enough depth and detail while remaining clear and providing decent sample implementations. I like things like this.