/usr/share/pyshared/zope/server/http/publisherhttpserver.py is in python-zope.server 3.8.6-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | ##############################################################################
#
# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""HTTP Server that uses the Zope Publisher for executing a task.
"""
from zope.server.http import wsgihttpserver
from zope.publisher.publish import publish
import zope.security.management
class PublisherHTTPServer(wsgihttpserver.WSGIHTTPServer):
def __init__(self, request_factory, sub_protocol=None, *args, **kw):
def application(environ, start_response):
request = request_factory(environ['wsgi.input'], environ)
request = publish(request)
response = request.response
start_response(response.getStatusString(), response.getHeaders())
return response.consumeBody()
return super(PublisherHTTPServer, self).__init__(
application, sub_protocol, *args, **kw)
class PMDBHTTPServer(wsgihttpserver.WSGIHTTPServer):
def __init__(self, request_factory, sub_protocol=None, *args, **kw):
def application(environ, start_response):
request = request_factory(environ['wsgi.input'], environ)
try:
request = publish(request, handle_errors=False)
except:
import sys, pdb
print "%s:" % sys.exc_info()[0]
print sys.exc_info()[1]
zope.security.management.restoreInteraction()
try:
pdb.post_mortem(sys.exc_info()[2])
raise
finally:
zope.security.management.endInteraction()
response = request.response
start_response(response.getStatusString(), response.getHeaders())
return response.consumeBody()
return super(PublisherHTTPServer, self).__init__(
application, sub_protocol, *args, **kw)
|