More url_for() fixes.

Stuff seems to work, although testing is arduous due to `nosetests` not working on bare non-production trees. I'll see about fixing that at some point.