Commit e4c17d80 authored by Evan Simpson's avatar Evan Simpson

Merge change from Zope-2_5-branch

parent 4421a558
...@@ -12,10 +12,10 @@ ...@@ -12,10 +12,10 @@
############################################################################## ##############################################################################
'''CGI Response Output formatter '''CGI Response Output formatter
$Id: HTTPResponse.py,v 1.53 2002/01/02 15:56:04 andreasjung Exp $''' $Id: HTTPResponse.py,v 1.54 2002/03/15 22:34:17 evan Exp $'''
__version__='$Revision: 1.53 $'[11:-2] __version__='$Revision: 1.54 $'[11:-2]
import types, sys, re import types, os, sys, re
from string import translate, maketrans from string import translate, maketrans
from types import StringType, InstanceType, LongType from types import StringType, InstanceType, LongType
from BaseResponse import BaseResponse from BaseResponse import BaseResponse
...@@ -92,6 +92,17 @@ start_of_header_search=re.compile('(<head[^>]*>)', re.IGNORECASE).search ...@@ -92,6 +92,17 @@ start_of_header_search=re.compile('(<head[^>]*>)', re.IGNORECASE).search
accumulate_header={'set-cookie': 1}.has_key accumulate_header={'set-cookie': 1}.has_key
tb_style = os.environ.get('HTTP_TRACEBACK_STYLE', '').lower()
if tb_style == 'none':
tb_delims = None, None
elif tb_style == 'js':
tb_delims = ('''<pre onclick="this.firstChild.data=this.lastChild.data">
&sect;<!--''', '--></pre>')
elif tb_style == 'plain':
tb_delims = '<pre>', '</pre>'
else:
tb_delims = '<!--', '-->'
class HTTPResponse(BaseResponse): class HTTPResponse(BaseResponse):
"""\ """\
An object representation of an HTTP response. An object representation of an HTTP response.
...@@ -399,9 +410,9 @@ class HTTPResponse(BaseResponse): ...@@ -399,9 +410,9 @@ class HTTPResponse(BaseResponse):
tb = '\n'.join(tb) tb = '\n'.join(tb)
tb = self.quoteHTML(tb) tb = self.quoteHTML(tb)
if self.debug_mode: _tbopen, _tbclose = '<PRE>', '</PRE>' if self.debug_mode: _tbopen, _tbclose = '<PRE>', '</PRE>'
else: _tbopen, _tbclose = '''<pre else: _tbopen, _tbclose = tb_delims
onclick="this.firstChild.data=this.lastChild.data"> if _tbopen is None:
&sect;<!--''', '--></pre>' return ''
return "\n%s\n%s\n%s" % (_tbopen, tb, _tbclose) return "\n%s\n%s\n%s" % (_tbopen, tb, _tbclose)
def redirect(self, location, status=302, lock=0): def redirect(self, location, status=302, lock=0):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment