I just noticed that the publish method from the Functional base class
from ZopeTestCase has the same problem. You can find the adjusted test
Hanno Schlichting wrote:
> Hi all,
> while pushing local site support in CMF/Plone I came across some weird
> test failures. After a while of debbuging I could track this down to the
> http method in ZopeTestCase's doctest support.
> The method in its Zope2 incarnation is not aware of local sites, while
> the one in zope.app.testing is.
> I have attached a patch that mirrors the Zope3 behavior and saves the
> site information before publishing a module and restores it back, just
> like the security manager is saved/restored.
> As this is causing some test failures in Plone 3 now, I would be happy
> if somebody could take a look at this.
> Thank you,
@@ -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()
# Commit the sandbox for good measure
@@ -89,6 +94,9 @@
# Restore security manager
+ # And we need to restore the site again
return ResponseWrapper(response, outstream, path)
Zope-Dev maillist - Zope-Dev@zope.org
** No cross posts or HTML encoding! **
(Related lists -