/usr/share/pyshared/zope/publisher/tests/test_paste.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 | ##############################################################################
#
# Copyright (c) Zope Corporation 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.
#
##############################################################################
import re, unittest
import doctest
from zope.testing import renormalizing
class SamplePublication:
def __init__(self, global_config, **options):
self.args = global_config, options
def beforeTraversal(self, request):
pass
def getApplication(self, request):
return self
def callTraversalHooks(self, request, ob):
pass
def traverseName(self, request, ob, name):
return self
def afterTraversal(self, request, ob):
pass
def callObject(self, request, ob):
return (u'<html><body>Thanks for your request:<br />\n'
u'<h1>%s</h1>\n<pre>\n%s\n</pre>\n'
u'<h1>Publication arguments:</h1>\n'
u'Globals: %r<br />\nOptions: %r\n</body></html>'
% (request.__class__.__name__, request,
self.args[0], self.args[1])
)
def afterCall(self, request, ob):
pass
def handleException(self, object, request, exc_info, retry_allowed=1):
return 'Ouch!'
def endRequest(self, request, ob):
pass
def getDefaultTraversal(self, request, ob):
return self, ()
def test_suite():
return unittest.TestSuite((
doctest.DocFileSuite(
'../paste.txt',
optionflags=doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE,
),
))
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
|