Merge a couple of fixes that are related to http://www.zope.org/Collectors/Zope/1947

and http://mail.zope.org/pipermail/zope-dev/2005-December/026236.html from the Five
repository:

Log message for r21321:
  Explain what this test does and fix misleading and risky usage of pprint

Log message for r21322:
  Fix this test and re-enable it

Log message for r21325:
  Add changes entry for some recently fixed bug
  update Five 1.2 changes history
  bump version number after 1.3c "release"
parent f7a07ad9
......@@ -2,6 +2,15 @@
Five Changes
============
Five 1.3 (unreleased)
=====================
Bugfixes
--------
* Fix functional test for local sites and re-enable it for standard
test runs.
Five 1.3c (2005-12-06)
======================
......@@ -75,11 +84,15 @@ Bugfixes
* Fixed loops in zcml loading due to events in some cases.
* Made Five send a ContainerModifiedEvent when appropriate.
Restructuring
-------------
* Cleaned up security test.
* Added monkey so that ++skin++ works with Zope <= 2.8.4.
Five 1.2b (2005-11-02)
======================
......
Functional test for local sites
===============================
Set up all of Five:
This tests how local site managers are found during traversal and how
that affects component lookup (depending on whether a site is
traversed or not, local components might or might not be found).
First, we set up all of Five:
>>> import Products.Five
>>> from Products.Five import zcml
>>> zcml.load_config("configure.zcml", Products.Five)
First we turn our DummySite class into a site in ZCML (and register
Then we hook up the custom component architecture calls; we need to do
this here because zope.app.component.hooks registers a cleanup with
the testing cleanup framework, so the hooks get torn down by
placelesssetup each time.
>>> from zope.app.component.hooks import setHooks
>>> setHooks()
Next we turn our DummySite class into a site in ZCML (and register
some views that will provide us with some test info),
>>> zcml_text = """
......@@ -50,9 +62,9 @@ Now we check what the info view tells us about local component lookup:
... ''')
HTTP/1.1 200 OK
...
{'IFiveUtilityRegistry.providedBy(utility_service)': False,
'isinstance(zapi.getSiteManager(), FiveSiteManager)': False,
'zapi.getSiteManager() is zapi.getGlobalSiteManager()': True}
zapi.getSiteManager() is zapi.getGlobalSiteManager(): True
IFiveUtilityRegistry.providedBy(utility_service): False
isinstance(zapi.getSiteManager(), FiveSiteManager): False
We see that we have no local component lookup yet, because we haven't
set the site. Therefore, enable the traversal hook by using the view
......@@ -79,9 +91,9 @@ is working:
... ''')
HTTP/1.1 200 OK
...
{'IFiveUtilityRegistry.providedBy(utility_service)': True,
'isinstance(zapi.getSiteManager(), FiveSiteManager)': True,
'zapi.getSiteManager() is zapi.getGlobalSiteManager()': False}
zapi.getSiteManager() is zapi.getGlobalSiteManager(): False
IFiveUtilityRegistry.providedBy(utility_service): True
isinstance(zapi.getSiteManager(), FiveSiteManager): True
Of course, sites are only active *during* traversal; after traversal
they're gone:
......@@ -137,9 +149,9 @@ lookup:
... ''')
HTTP/1.1 200 OK
...
{'IFiveUtilityRegistry.providedBy(utility_service)': False,
'isinstance(zapi.getSiteManager(), FiveSiteManager)': False,
'zapi.getSiteManager() is zapi.getGlobalSiteManager()': True}
zapi.getSiteManager() is zapi.getGlobalSiteManager(): True
IFiveUtilityRegistry.providedBy(utility_service): False
isinstance(zapi.getSiteManager(), FiveSiteManager): False
Finally, global services and the monkeys:
......
......@@ -31,15 +31,13 @@ class CheckSiteManagerView(BrowserView):
def __call__(self):
sm = zapi.getSiteManager()
result = {
'zapi.getSiteManager() is zapi.getGlobalSiteManager()':
sm is zapi.getGlobalSiteManager(),
'IFiveUtilityRegistry.providedBy(utility_service)':
IFiveUtilityRegistry.providedBy(sm.utilities),
'isinstance(zapi.getSiteManager(), FiveSiteManager)':
isinstance(sm, FiveSiteManager),
}
return pprint.pformat(result)
result = ('zapi.getSiteManager() is zapi.getGlobalSiteManager(): %s\n'
'IFiveUtilityRegistry.providedBy(utility_service): %s\n'
'isinstance(zapi.getSiteManager(), FiveSiteManager): %s'
% (sm is zapi.getGlobalSiteManager(),
IFiveUtilityRegistry.providedBy(sm.utilities),
isinstance(sm, FiveSiteManager)))
return result
class LookupUtilitiesView(BrowserView):
......@@ -50,10 +48,8 @@ class LookupUtilitiesView(BrowserView):
def test_suite():
from Testing.ZopeTestCase import FunctionalDocFileSuite
suite = FunctionalDocFileSuite('functional.txt',
package='Products.Five.site.tests')
suite.level = 2
return suite
return FunctionalDocFileSuite('functional.txt',
package='Products.Five.site.tests')
if __name__ == '__main__':
framework()
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