Switch to use Pyramid for the wsgi app.

For now there are still some hacks to keep the changes minimal.
We still use Bottle as the wsgi server, so the ``--bottleserver`` still works.
Explicitly pass the request around.