Py3k compatibility

This also updates the Flask-SQLAlchemy to a recent, py3k-compatible version.

All tests are green (tested on 2.7 and 3.4), and this time they actually work through `test.sh` as well…