/usr/share/pyshared/zope/publisher/tests/publication.py is in python-zope.publisher 3.12.6-2ubuntu1.
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 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | ##############################################################################
#
# 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.
#
##############################################################################
"""Publication test
"""
from zope.publisher.interfaces import IPublication
from zope.interface import implements
class TestPublication(object):
implements(IPublication)
def afterCall(self, request, ob):
'''See interface IPublication'''
self._afterCall = getattr(self, '_afterCall', 0) + 1
def endRequest(self, request, ob):
'''See interface IPublication'''
self._endRequest = getattr(self, '_endRequest', 0) + 1
def traverseName(self, request, ob, name, check_auth=1):
'''See interface IPublication'''
return getattr(ob, name, "%s value" % name)
def afterTraversal(self, request, ob):
'''See interface IPublication'''
self._afterTraversal = getattr(self, '_afterTraversal', 0) + 1
def beforeTraversal(self, request):
'''See interface IPublication'''
self._beforeTraversal = getattr(self, '_beforeTraversal', 0) + 1
def callObject(self, request, ob):
'''See interface IPublication'''
return ob(request)
def getApplication(self, request):
'''See interface IPublication'''
return app
def handleException(self, object, request, exc_info, retry_allowed=1):
'''See interface IPublication'''
try:
request.response.setResult("%s: %s" % (exc_info[:2]))
finally:
exc_info = 0
def callTraversalHooks(self, request, ob):
'''See interface IPublication'''
self._callTraversalHooks = getattr(self, '_callTraversalHooks', 0) + 1
class App(object):
def __init__(self, name):
self.name = name
def index_html(self, request):
return self
app = App('')
app.ZopeCorp = App('ZopeCorp')
app.ZopeCorp.Engineering = App('Engineering')
|