Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
56692de5
Commit
56692de5
authored
Mar 08, 2007
by
Wichert Akkerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set and restore the site for functional tests as well. Forward port from 2.10 branch
parent
a581a35f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
lib/python/Testing/ZopeTestCase/functional.py
lib/python/Testing/ZopeTestCase/functional.py
+8
-0
lib/python/Testing/ZopeTestCase/zopedoctest/functional.py
lib/python/Testing/ZopeTestCase/zopedoctest/functional.py
+8
-0
No files found.
lib/python/Testing/ZopeTestCase/functional.py
View file @
56692de5
...
@@ -39,6 +39,7 @@ class Functional(sandbox.Sandboxed):
...
@@ -39,6 +39,7 @@ class Functional(sandbox.Sandboxed):
request_method
=
'GET'
,
stdin
=
None
,
handle_errors
=
True
):
request_method
=
'GET'
,
stdin
=
None
,
handle_errors
=
True
):
'''Publishes the object at 'path' returning a response object.'''
'''Publishes the object at 'path' returning a response object.'''
from
zope.app.component.hooks
import
setSite
,
getSite
from
StringIO
import
StringIO
from
StringIO
import
StringIO
from
ZPublisher.Response
import
Response
from
ZPublisher.Response
import
Response
from
ZPublisher.Test
import
publish_module
from
ZPublisher.Test
import
publish_module
...
@@ -49,6 +50,10 @@ class Functional(sandbox.Sandboxed):
...
@@ -49,6 +50,10 @@ class Functional(sandbox.Sandboxed):
# Save current security manager
# Save current security manager
sm
=
getSecurityManager
()
sm
=
getSecurityManager
()
# And we need to store the old site
old_site
=
getSite
()
setSite
(
None
)
# Commit the sandbox for good measure
# Commit the sandbox for good measure
transaction
.
commit
()
transaction
.
commit
()
...
@@ -91,6 +96,9 @@ class Functional(sandbox.Sandboxed):
...
@@ -91,6 +96,9 @@ class Functional(sandbox.Sandboxed):
# Restore security manager
# Restore security manager
setSecurityManager
(
sm
)
setSecurityManager
(
sm
)
# And we need to restore the site again
setSite
(
old_site
)
return
ResponseWrapper
(
response
,
outstream
,
path
)
return
ResponseWrapper
(
response
,
outstream
,
path
)
...
...
lib/python/Testing/ZopeTestCase/zopedoctest/functional.py
View file @
56692de5
...
@@ -117,6 +117,7 @@ def http(request_string, handle_errors=True):
...
@@ -117,6 +117,7 @@ def http(request_string, handle_errors=True):
"""
"""
import urllib
import urllib
import rfc822
import rfc822
from zope.app.component.hooks import setSite, getSite
from cStringIO import StringIO
from cStringIO import StringIO
from ZPublisher.Response import Response
from ZPublisher.Response import Response
from ZPublisher.Test import publish_module
from ZPublisher.Test import publish_module
...
@@ -126,6 +127,10 @@ def http(request_string, handle_errors=True):
...
@@ -126,6 +127,10 @@ def http(request_string, handle_errors=True):
# Save current Security Manager
# Save current Security Manager
old_sm = getSecurityManager()
old_sm = getSecurityManager()
# And we need to store the old site
old_site = getSite()
setSite(None)
# Commit work done by previous python code.
# Commit work done by previous python code.
transaction.commit()
transaction.commit()
...
@@ -193,7 +198,10 @@ def http(request_string, handle_errors=True):
...
@@ -193,7 +198,10 @@ def http(request_string, handle_errors=True):
# by calling the publish method above
# by calling the publish method above
setSecurityManager(old_sm)
setSecurityManager(old_sm)
# And we need to restore the site again
setSite(old_site)
# Sync connection
# Sync connection
sync()
sync()
return DocResponseWrapper(response, outstream, path, header_output)
return DocResponseWrapper(response, outstream, path, header_output)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment