summaryrefslogtreecommitdiff
path: root/django/core
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2006-09-28 02:07:00 +0000
committerAdrian Holovaty <adrian@holovaty.com>2006-09-28 02:07:00 +0000
commitbeeb719c12f537b60a262e9f4f4e1f8dbc7c607d (patch)
tree4f922d45acf97e988635280921fcc04d1d409d85 /django/core
parent15e7805ae4e5a1ae30ec240a3e1ad6b8a4e32269 (diff)
Folded django.core.handlers.modpython.populate_apache_request into ModPythonHandler.__call__() to save the overhead of a function call, and because that logic didn't need to be abstracted.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3876 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/core')
-rw-r--r--django/core/handlers/modpython.py29
1 files changed, 13 insertions, 16 deletions
diff --git a/django/core/handlers/modpython.py b/django/core/handlers/modpython.py
index 78fc9f1759..d7f214ba90 100644
--- a/django/core/handlers/modpython.py
+++ b/django/core/handlers/modpython.py
@@ -160,23 +160,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.