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 @@ ...@@ -2,6 +2,15 @@
Five Changes 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) Five 1.3c (2005-12-06)
====================== ======================
...@@ -75,11 +84,15 @@ Bugfixes ...@@ -75,11 +84,15 @@ Bugfixes
* Fixed loops in zcml loading due to events in some cases. * Fixed loops in zcml loading due to events in some cases.
* Made Five send a ContainerModifiedEvent when appropriate.
Restructuring Restructuring
------------- -------------
* Cleaned up security test. * Cleaned up security test.
* Added monkey so that ++skin++ works with Zope <= 2.8.4.
Five 1.2b (2005-11-02) Five 1.2b (2005-11-02)
====================== ======================
......
Functional test for local sites 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 >>> import Products.Five
>>> from Products.Five import zcml >>> from Products.Five import zcml
>>> zcml.load_config("configure.zcml", Products.Five) >>> 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), some views that will provide us with some test info),
>>> zcml_text = """ >>> zcml_text = """
...@@ -50,9 +62,9 @@ Now we check what the info view tells us about local component lookup: ...@@ -50,9 +62,9 @@ Now we check what the info view tells us about local component lookup:
... ''') ... ''')
HTTP/1.1 200 OK HTTP/1.1 200 OK
... ...
{'IFiveUtilityRegistry.providedBy(utility_service)': False, zapi.getSiteManager() is zapi.getGlobalSiteManager(): True
'isinstance(zapi.getSiteManager(), FiveSiteManager)': False, IFiveUtilityRegistry.providedBy(utility_service): False
'zapi.getSiteManager() is zapi.getGlobalSiteManager()': True} isinstance(zapi.getSiteManager(), FiveSiteManager): False
We see that we have no local component lookup yet, because we haven't 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 set the site. Therefore, enable the traversal hook by using the view
...@@ -79,9 +91,9 @@ is working: ...@@ -79,9 +91,9 @@ is working:
... ''') ... ''')
HTTP/1.1 200 OK HTTP/1.1 200 OK
... ...
{'IFiveUtilityRegistry.providedBy(utility_service)': True, zapi.getSiteManager() is zapi.getGlobalSiteManager(): False
'isinstance(zapi.getSiteManager(), FiveSiteManager)': True, IFiveUtilityRegistry.providedBy(utility_service): True
'zapi.getSiteManager() is zapi.getGlobalSiteManager()': False} isinstance(zapi.getSiteManager(), FiveSiteManager): True
Of course, sites are only active *during* traversal; after traversal Of course, sites are only active *during* traversal; after traversal
they're gone: they're gone:
...@@ -137,9 +149,9 @@ lookup: ...@@ -137,9 +149,9 @@ lookup:
... ''') ... ''')
HTTP/1.1 200 OK HTTP/1.1 200 OK
... ...
{'IFiveUtilityRegistry.providedBy(utility_service)': False, zapi.getSiteManager() is zapi.getGlobalSiteManager(): True
'isinstance(zapi.getSiteManager(), FiveSiteManager)': False, IFiveUtilityRegistry.providedBy(utility_service): False
'zapi.getSiteManager() is zapi.getGlobalSiteManager()': True} isinstance(zapi.getSiteManager(), FiveSiteManager): False
Finally, global services and the monkeys: Finally, global services and the monkeys:
......
...@@ -31,15 +31,13 @@ class CheckSiteManagerView(BrowserView): ...@@ -31,15 +31,13 @@ class CheckSiteManagerView(BrowserView):
def __call__(self): def __call__(self):
sm = zapi.getSiteManager() sm = zapi.getSiteManager()
result = { result = ('zapi.getSiteManager() is zapi.getGlobalSiteManager(): %s\n'
'zapi.getSiteManager() is zapi.getGlobalSiteManager()': 'IFiveUtilityRegistry.providedBy(utility_service): %s\n'
sm is zapi.getGlobalSiteManager(), 'isinstance(zapi.getSiteManager(), FiveSiteManager): %s'
'IFiveUtilityRegistry.providedBy(utility_service)': % (sm is zapi.getGlobalSiteManager(),
IFiveUtilityRegistry.providedBy(sm.utilities), IFiveUtilityRegistry.providedBy(sm.utilities),
'isinstance(zapi.getSiteManager(), FiveSiteManager)': isinstance(sm, FiveSiteManager)))
isinstance(sm, FiveSiteManager), return result
}
return pprint.pformat(result)
class LookupUtilitiesView(BrowserView): class LookupUtilitiesView(BrowserView):
...@@ -50,10 +48,8 @@ class LookupUtilitiesView(BrowserView): ...@@ -50,10 +48,8 @@ class LookupUtilitiesView(BrowserView):
def test_suite(): def test_suite():
from Testing.ZopeTestCase import FunctionalDocFileSuite from Testing.ZopeTestCase import FunctionalDocFileSuite
suite = FunctionalDocFileSuite('functional.txt', return FunctionalDocFileSuite('functional.txt',
package='Products.Five.site.tests') package='Products.Five.site.tests')
suite.level = 2
return suite
if __name__ == '__main__': if __name__ == '__main__':
framework() 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