Skip to content

Reliably Broken

Using plists for site-specific Django settings

I have a Django project that I am going to deploy at several sites, but I need to tweak the project settings slightly for each site. Specifically I need different a EMAIL_HOST address and related settings for sending mail at each site.

Read more →

May 20, 2009

10.5.7 fixes AppleShare speeds

The recently-released Mac OS X 10.5.7 update fixes the atrocious AppleShare transfer speed bug that was introduced by 10.5.6. The problem was that copying files larger than a few hundred kilobytes to certain AppleShare servers (including Mac OS X Server 10.4.11) would go extremely slow, and usually fail after a minute.

Read more →

May 20, 2009

Package installer wish

Mac OS X administrators frequently need to build installer packages to help deploy and manage software on a network of Macs. The motive for creating a package is one of

Read more →

April 13, 2009

Python features for a PHP refugee

These are things that particularly impressed me when I decided I had had enough of PHP and I really ought to look at the crazy white-space language called Python that was used by Plone, Trac and Django.

Read more →

April 10, 2009

Q and operator.or_

I’ve finally settled on a nice syntax for OR-ing Django Q objects. For a simple site search feature I needed to search for a term across several fields in a model. Suppose the model looks like this:

Read more →

April 9, 2009

reverse() chicken and egg problem

I wound up in a chicken and egg situation today using Django’s syndication framework and the reverse helper. The problem was that immediately after starting the development server, Django would throw a NoReverseMatch exception on the first client visit, followed by AttributeError on all subsequent visits.

Read more →

March 30, 2009

Using an object for Django's ChoiceField choices

I had another thought about per-instance choices for forms.ChoiceField. Instead of overriding the __init__ method of your form class, you could use an object with an __iter__ method that returns a fresh iterable each time it is called.

Read more →

March 29, 2009

Django test database runner as a context manager

In my last post I mentioned it might be an idea to wrap up the Django test database setup / teardown in a context manager for use with Python’s with statement. Here’s my first stab, which seems to work.

Read more →

March 28, 2009

Creating a Django test database for unit testing

I needed to run tests involving a Django application but without using the manage.py test management command. So I need my own test suite that sets up the test database and drops it after, leaving my real database untouched.

Read more →

March 27, 2009

sys.exit(1) versus SystemExit(1)

I used to write Python scripts and have the option parsing go something like this…

Read more →

March 26, 2009