jamwt/diesel — pull request #47 by dowski (2012-10-23 18:32:17+00:00)
Title: Service API Addition + WSGI Fixes

In order to interoperate with Flask for `diesel.web`, diesel needs to build up a WSGI environment dictionary for each HTTP request. It was missing two required fields: `SERVER_NAME` and `SERVER_PORT`. This change adds those.

In order to get the value for `SERVER_PORT` without making some user-facing API changes, I added a new `on_service_init`optional method on the `connection_hander` that is passed to the `Service` constructor. It gets called with the `Service` instance itself so the connection handler can use information about the `Service` (like the port number) while serving clients.