Commit e297f298 authored by 's avatar

Fixed bug in insertBase that I introduced while implementing support for

content-type headers with charset attributes.
parent 590247e5
...@@ -84,8 +84,8 @@ ...@@ -84,8 +84,8 @@
############################################################################## ##############################################################################
'''CGI Response Output formatter '''CGI Response Output formatter
$Id: HTTPResponse.py,v 1.32 2000/08/07 17:15:25 brian Exp $''' $Id: HTTPResponse.py,v 1.33 2000/08/08 16:06:00 brian Exp $'''
__version__='$Revision: 1.32 $'[11:-2] __version__='$Revision: 1.33 $'[11:-2]
import string, types, sys, regex, re import string, types, sys, regex, re
from string import find, rfind, lower, upper, strip, split, join, translate from string import find, rfind, lower, upper, strip, split, join, translate
...@@ -320,16 +320,17 @@ class HTTPResponse(BaseResponse): ...@@ -320,16 +320,17 @@ class HTTPResponse(BaseResponse):
def setBase(self,base): def setBase(self,base):
'Set the base URL for the returned document.' 'Set the base URL for the returned document.'
if base[-1:] != '/': base=base+'/' if base[-1:] != '/':
base=base+'/'
self.base=base self.base=base
self.insertBase()
def insertBase(self, def insertBase(self,
base_re_search=regex.compile('\(<base[\0- ]+[^>]+>\)', base_re_search=regex.compile('\(<base[\0- ]+[^>]+>\)',
regex.casefold).search regex.casefold).search
): ):
# Only insert a base tag if content appears to be html. # Only insert a base tag if content appears to be html.
if self.headers.get('content-type', '')[:9] != 'text/html': content_type = self.headers.get('content-type', '')[:9]
if content_type and (content_type != 'text/html'):
return return
if self.base: if self.base:
......
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