Log message for revision 73047: Set and restore the site for functional tests as well
Changed: U Zope/branches/2.10/lib/python/Testing/ZopeTestCase/functional.py U Zope/branches/2.10/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py -=- Modified: Zope/branches/2.10/lib/python/Testing/ZopeTestCase/functional.py =================================================================== --- Zope/branches/2.10/lib/python/Testing/ZopeTestCase/functional.py 2007-03-08 00:58:14 UTC (rev 73046) +++ Zope/branches/2.10/lib/python/Testing/ZopeTestCase/functional.py 2007-03-08 01:23:02 UTC (rev 73047) @@ -37,6 +37,7 @@ request_method='GET', stdin=None, handle_errors=True): '''Publishes the object at 'path' returning a response object.''' + from zope.app.component.hooks import setSite, getSite from StringIO import StringIO from ZPublisher.Response import Response from ZPublisher.Test import publish_module @@ -47,6 +48,10 @@ # Save current security manager sm = getSecurityManager() + # And we need to store the old site + old_site = getSite() + setSite(None) + # Commit the sandbox for good measure transaction.commit() @@ -89,6 +94,9 @@ # Restore security manager setSecurityManager(sm) + # And we need to restore the site again + setSite(old_site) + return ResponseWrapper(response, outstream, path) Modified: Zope/branches/2.10/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py =================================================================== --- Zope/branches/2.10/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py 2007-03-08 00:58:14 UTC (rev 73046) +++ Zope/branches/2.10/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py 2007-03-08 01:23:02 UTC (rev 73047) @@ -117,6 +117,7 @@ """ import urllib import rfc822 + from zope.app.component.hooks import setSite, getSite from cStringIO import StringIO from ZPublisher.Response import Response from ZPublisher.Test import publish_module @@ -126,6 +127,10 @@ # Save current Security Manager old_sm = getSecurityManager() + # And we need to store the old site + old_site = getSite() + setSite(None) + # Commit work done by previous python code. transaction.commit() @@ -193,7 +198,10 @@ # by calling the publish method above setSecurityManager(old_sm) + # And we need to restore the site again + setSite(old_site) # Sync connection + sync() return DocResponseWrapper(response, outstream, path, header_output) _______________________________________________ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins