There is a bug in urlparse.urljoin which means that a relative URL which is just a query string is not correctly added to the base. This is a workaround for that. Once we have Python 2.6 it can all go back to how it was before.