From e07dae7b77abc39d3e5d99dece5d43a5b99890f4 Mon Sep 17 00:00:00 2001 From: Jason Pellerin Date: Mon, 4 Dec 2006 18:16:40 +0000 Subject: [multi-db] Merged trunk to [3890] git-svn-id: http://code.djangoproject.com/svn/django/branches/multiple-db-support@4152 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/core/handlers/modpython.py | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) (limited to 'django/core/handlers/modpython.py') diff --git a/django/core/handlers/modpython.py b/django/core/handlers/modpython.py index 78fc9f1759..bf759db068 100644 --- a/django/core/handlers/modpython.py +++ b/django/core/handlers/modpython.py @@ -139,10 +139,6 @@ class ModPythonHandler(BaseHandler): # that use settings now can work from django.conf import settings - if settings.ENABLE_PSYCO: - import psyco - psyco.profile() - # if we need to set up middleware, now that settings works we can do it now. if self._request_middleware is None: self.load_middleware() @@ -160,23 +156,20 @@ class ModPythonHandler(BaseHandler): dispatcher.send(signal=signals.request_finished) # Convert our custom HttpResponse object back into the mod_python req. - populate_apache_request(response, req) - return 0 # mod_python.apache.OK + req.content_type = response['Content-Type'] + for key, value in response.headers.items(): + if key != 'Content-Type': + req.headers_out[key] = value + for c in response.cookies.values(): + req.headers_out.add('Set-Cookie', c.output(header='')) + req.status = response.status_code + try: + for chunk in response: + req.write(chunk) + finally: + response.close() -def populate_apache_request(http_response, mod_python_req): - "Populates the mod_python request object with an HttpResponse" - mod_python_req.content_type = http_response['Content-Type'] - for key, value in http_response.headers.items(): - if key != 'Content-Type': - mod_python_req.headers_out[key] = value - for c in http_response.cookies.values(): - mod_python_req.headers_out.add('Set-Cookie', c.output(header='')) - mod_python_req.status = http_response.status_code - try: - for chunk in http_response: - mod_python_req.write(chunk) - finally: - http_response.close() + return 0 # mod_python.apache.OK def handler(req): # mod_python hooks into this function. -- cgit v1.3