Make it easier to catch accidental screwups
This primarily involved fixing the user-agent detection code, but also involves fixing tests for the /spend page, which assumed the order in which users were listed in the form. This was changed by 88740b2, but nobody noticed since the test suite wasn't running.
Routes dropped the routes.redirect_for hepler, and Pylons switched by default to using a "strict" template context object (i.e. one which throws an exception when accessing an unset attribute, instead of returning an empty string). Create our own redirect_for, and switch the template context back to lax.
Try catching onchange as well
This test is inspired by a real-world scenario where BlueChips didn't do the right thing.
For any given expense involving N users, rounding errors will result in no more than N - 1 pennies needing to be redistributed. Instead of randomly assigning them one at a time (which can end with an unlucky user), choose a subset of the involved users to each get one of the pennies.
It seems that at least some recent versions of Mako don't convert objects to strings before attempting to render them, leading to a TypeError for things like flash messages, which are no objects and not just strings. Reported-by: João Felipe Santos <email@example.com>