Category Archives: python

More than a side salad: behaviour driven testing and test driven design in Django with Lettuce

Been quiet lately because I am super busy getting a project out of the door. However I did find time to give this talk last night on behaviour driven testing with Lettuce at MelbDjango. More than a side salad: behaviour … Continue reading

Posted in best practice, django, python | 3 Comments

generic lettuce steps for Django models

After I left the Bureau approximately a month ago I’ve taken up a new role with Infoxchange Australia. My first project here is working on a rewrite of an application using Django. People here are really into behaviour driven testing, … Continue reading

Posted in python | Comments Off

Generating JSON from SQLAlchemy objects

I had to put together a small web app the other day, using SQLAlchemy and Flask. Because I hate writing code multiple times, when I can do things using a better way, I wanted to be able to serialise SQLAlchemy … Continue reading

Posted in python | 3 Comments

Testing warnings with py.test

For those who use like to add warnings to your Python code, and want to test those warnings actually happen in your unit tests, here are two techniques to do so, both are based around fixtures/funcargs. Firstly is the mechanism … Continue reading

Posted in python | Comments Off

fixing button theming with GtkBuilder

This is a bit icky. It would be neater if the Python bindings exposed hildon_gtk_widget_set_theme_size(), but not much. So, to fix the button theming if you've created your interface with GtkBuilder, it looks something like this: # these aren't exported … Continue reading

Posted in hacking, kludge, maemo, python | Comments Off

happy new year

Had a pleasant day off eating snacks, watching The Pretender with friends and hacking on my tram tracking app. I added geolocation, which meant needing to test on the device, so I had to package up python-suds for Maemo (git-buildpackage … Continue reading

Posted in hacking, maemo, packaging, python, tramtracker | Comments Off

a hacky way of monitoring messages in Telepathy

Sometimes people come up with some creative solutions to solve their problems. The correct way to monitor data, such as messages, coming from Telepathy is to write an Observer, however sometimes you just want to get a feed of all … Continue reading

Posted in hacking, python, telepathy | Comments Off

Melbourne Tram Tracker for the N900

So Collabora's robotic and non-robotic overlords very graciously bought everyone on staff an N900 for Christmas. In my opinion, it's actually a very nice phone (although possibly a little on the large side); but the let down is there just … Continue reading

Posted in hacking, maemo, melbourne, python, tramtracker | Comments Off

a threaded processing queue in PyGTK

I'm currently writing a PyGTK client that needs to make network requests using a library that doesn't integrate with the GLib mainloop (python-suds), so I found myself wanting to be able to make network requests without blocking the mainloop, and … Continue reading

Posted in example code, hacking, maemo, python, threading | Comments Off

Useful python trick of the day: dict.get()

How often in Python have you written something like: d[k] if k in d else "Default" Admittedly this has gotten a lot shorter since the inclusion of ternary operators in Python, but did you know that Python provides a get … Continue reading

Posted in hacking, programming, python | Comments Off