def __call__(self, environ, start_response): try: request = WSGIRequest(environ) except: response = http.responses.error.HttpResponseBadRequest() else: response = get_response(request) if not isinstance(response, WSGIResponse) response = WSGIResponse(old=response) start_response(response.status_line, response.header) if not hasattr(response, "__iter__", False): return [become_unicode(response)] return become_unicode(response)
def __call__(self, raw_data): try: request = http.Request(raw_data) except: response = http.responses.error.HttpResponseBadRequest() else: response = get_response(request) return become_unicode(response.writable())