Commit d9572241 authored by Jim Fulton's avatar Jim Fulton

Removed some Response.setBase cruft.

parent ab3d63f7
......@@ -362,7 +362,7 @@ Publishing a module using CGI
containing the module to be published) to the module name in the
cgi-bin directory.
$Id: Publish.py,v 1.74 1998/01/14 14:25:10 jim Exp $"""
$Id: Publish.py,v 1.75 1998/01/14 16:32:42 jim Exp $"""
#'
# Copyright
#
......@@ -417,7 +417,7 @@ $Id: Publish.py,v 1.74 1998/01/14 14:25:10 jim Exp $"""
# See end of file for change log.
#
##########################################################################
__version__='$Revision: 1.74 $'[11:-2]
__version__='$Revision: 1.75 $'[11:-2]
def main():
......@@ -715,7 +715,7 @@ class ModulePublisher:
entry_name=method
try:
if hasattr(object,entry_name):
response.setBase(URL+'/','')
response.setBase(URL)
path=[entry_name]
else:
try:
......@@ -782,7 +782,7 @@ class ModulePublisher:
# Check for method:
if not path:
if hasattr(object,method) and entry_name != method:
response.setBase(URL+'/','')
response.setBase(URL)
path=[method]
elif (hasattr(object, '__call__') and
hasattr(object.__call__,'__roles__')):
......
......@@ -3,7 +3,7 @@
__doc__='''CGI Response Output formatter
$Id: Response.py,v 1.23 1997/12/31 17:22:56 jim Exp $'''
$Id: Response.py,v 1.24 1998/01/14 16:32:56 jim Exp $'''
# Copyright
#
# Copyright 1996 Digital Creations, L.C., 910 Princess Anne
......@@ -53,7 +53,7 @@ $Id: Response.py,v 1.23 1997/12/31 17:22:56 jim Exp $'''
# Digital Creations, info@Digicool.com
# (540) 371-6909
#
__version__='$Revision: 1.23 $'[11:-2]
__version__='$Revision: 1.24 $'[11:-2]
import string, types, sys, regex, regsub
from string import find, rfind, lower, upper, strip, split, join
......@@ -266,17 +266,14 @@ class Response:
'Returns the current HTTP status code as an integer. '
return self.status
def setBase(self,base, URL):
def setBase(self,base):
'Set the base URL for the returned document.'
if base[-1:] != '/': base=base+'/'
self.base=base
self.URL=URL
self.insertBase()
def host(self,base):
return base[:find(base,'/',find(base,'//'))]
def insertBase(self,
base_re=regex.compile('\(<base[\0- ]+\([^>]+\)>\)',
base_re=regex.compile('<base[\0- ]+[^>]+>\)',
regex.casefold)
):
if (self.headers.has_key('content-type') and
......@@ -291,25 +288,6 @@ class Response:
if b < 0:
self.body=('%s\t<base href="%s">\n%s' %
(body[:e],self.base,body[e:]))
elif self.URL:
href=base_re.group(2)
base=''
if href[:1]=='/':
base=self.host(self.base)+href
elif href[:1]=='.':
base=self.URL
while href[:1]=='.':
if href[:2]=='./' or href=='.':
href=href[2:]
elif href[:3]=='../' or href=='..':
href=href[3:]
base=base[:rfind(base,'/')]
else:
break
if base:
self.body=("%s<base %s>%s" %
(body[:b],base,
body[b+len(base_re.group(1)):]))
def appendCookie(self, name, value):
'''\
......
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