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
88c83fc6
Commit
88c83fc6
authored
Nov 05, 2008
by
Matthew Wilkes
Browse files
Options
Browse Files
Download
Plain Diff
Backported DoomedTransaction handling from trunk r92792 to 2.11 branch
parents
34411c84
e9ed54f5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
2 deletions
+56
-2
lib/python/Zope2/App/startup.py
lib/python/Zope2/App/startup.py
+13
-2
lib/python/Zope2/App/tests/testDoomedTransaction.py
lib/python/Zope2/App/tests/testDoomedTransaction.py
+43
-0
No files found.
lib/python/Zope2/App/startup.py
View file @
88c83fc6
...
...
@@ -249,7 +249,15 @@ class ZPublisherExceptionHook:
REQUEST
[
'AUTHENTICATED_USER'
]
=
AccessControl
.
User
.
nobody
try
:
f
(
client
,
REQUEST
,
t
,
v
,
traceback
,
error_log_url
=
error_log_url
)
result
=
f
(
client
,
REQUEST
,
t
,
v
,
traceback
,
error_log_url
=
error_log_url
)
if
result
is
not
None
:
t
,
v
,
traceback
=
result
response
=
REQUEST
.
RESPONSE
response
.
setStatus
(
t
)
response
.
setBody
(
v
)
return
response
except
TypeError
:
# Pre 2.6 call signature
f
(
client
,
REQUEST
,
t
,
v
,
traceback
)
...
...
@@ -267,7 +275,10 @@ class TransactionsManager:
transaction
.
begin
()
def
commit
(
self
):
transaction
.
commit
()
if
hasattr
(
transaction
,
'isDoomed'
)
and
transaction
.
isDoomed
():
transaction
.
abort
()
else
:
transaction
.
commit
()
def
abort
(
self
):
transaction
.
abort
()
...
...
lib/python/Zope2/App/tests/testDoomedTransaction.py
0 → 100644
View file @
88c83fc6
##############################################################################
#
# Copyright (c) 2007 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
import
sys
import
unittest
import
logging
import
transaction
class
DoomedTransactionInManagerTest
(
unittest
.
TestCase
):
def
testDoomedFails
(
self
):
transaction
.
begin
()
trans
=
transaction
.
get
()
trans
.
doom
()
from
transaction.interfaces
import
DoomedTransaction
self
.
assertRaises
(
DoomedTransaction
,
trans
.
commit
)
def
testDoomedSilentInTM
(
self
):
from
Zope2.App.startup
import
TransactionsManager
tm
=
TransactionsManager
()
transaction
.
begin
()
trans
=
transaction
.
get
()
trans
.
doom
()
tm
.
commit
()
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
DoomedTransactionInManagerTest
))
return
suite
if
__name__
==
'__main__'
:
unittest
.
main
(
defaultTest
=
'test_suite'
)
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