/usr/share/pyshared/zope/app/publication/site.txt is in python-zope.app.publication 3.13.2-0ubuntu2.
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 | ======================
Using the site manager
======================
This test ensures that the site is correctly set and cleared in a thread
during traversal using event subscribers. Before we start, no site is set:
>>> from zope.component import hooks
>>> hooks.getSite() is None
True
>>> request = object()
>>> from zope.app.publication import interfaces
>>> from zope import site
On the other hand, if a site is traversed,
>>> from zope.site.tests.test_site import SiteManagerStub, CustomFolder
>>> sm = SiteManagerStub()
>>> mysite = CustomFolder('mysite')
>>> mysite.setSiteManager(sm)
>>> from zope.traversing.interfaces import BeforeTraverseEvent
>>> ev = BeforeTraverseEvent(mysite, request)
>>> site.threadSiteSubscriber(mysite, ev)
>>> hooks.getSite()
<CustomFolder mysite>
Once the request is completed,
>>> from zope.publisher.interfaces import EndRequestEvent
>>> ev = EndRequestEvent(mysite, request)
>>> site.clearThreadSiteSubscriber(ev)
the site assignment is cleared again:
>>> hooks.getSite() is None
True
|