Commit e22b2dea authored by Jim Fulton's avatar Jim Fulton

Added outputBody protocol for reqponse objects so that response

objects can control what happens with their data.  The ORB will call this method, rather than str-ing and writing the response itself.
parent febfb34c
......@@ -84,8 +84,8 @@
##############################################################################
'''CGI Response Output formatter
$Id: BaseResponse.py,v 1.4 1999/08/04 18:05:26 jim Exp $'''
__version__='$Revision: 1.4 $'[11:-2]
$Id: BaseResponse.py,v 1.5 1999/09/23 21:55:12 jim Exp $'''
__version__='$Revision: 1.5 $'[11:-2]
import string, types, sys, regex
from string import find, rfind, lower, upper, strip, split, join, translate
......@@ -119,6 +119,9 @@ class BaseResponse:
__setitem__=setHeader
def outputBody(self):
"""Output the response body"""
self.stdout.write(str(self))
def setBody(self, body):
self.body=body
......
......@@ -84,8 +84,8 @@
##############################################################################
__doc__="""Python Object Publisher -- Publish Python objects on web servers
$Id: Publish.py,v 1.142 1999/09/08 14:52:07 brian Exp $"""
__version__='$Revision: 1.142 $'[11:-2]
$Id: Publish.py,v 1.143 1999/09/23 21:57:46 jim Exp $"""
__version__='$Revision: 1.143 $'[11:-2]
import sys, os
from string import lower, atoi, rfind, strip
......@@ -225,9 +225,12 @@ def publish_module(module_name,
status=response.getStatus()
if response:
response=str(response)
if response:
stdout.write(response)
outputBody=getattr(response, 'outputBody', None)
if outputBody is not None:
outputBody()
else:
response=str(response)
if response: stdout.write(response)
# The module defined a post-access function, call it
if after_list[0] is not None: after_list[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