Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
ZODB
Commits
6457bcfd
Commit
6457bcfd
authored
Sep 17, 2013
by
Godefroid Chapelle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
savepoint rollback after readcurrent of new object should not raise POSKeyError
parent
6ffd2f71
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
0 deletions
+44
-0
src/ZODB/Connection.py
src/ZODB/Connection.py
+1
-0
src/ZODB/tests/testZODB.py
src/ZODB/tests/testZODB.py
+43
-0
No files found.
src/ZODB/Connection.py
View file @
6457bcfd
...
@@ -448,6 +448,7 @@ class Connection(ExportImport, object):
...
@@ -448,6 +448,7 @@ class Connection(ExportImport, object):
oid
=
obj
.
_p_oid
oid
=
obj
.
_p_oid
assert
oid
is
not
None
assert
oid
is
not
None
if
oid
in
self
.
_added
:
if
oid
in
self
.
_added
:
self
.
_readCurrent
.
pop
(
oid
,
None
)
del
self
.
_added
[
oid
]
del
self
.
_added
[
oid
]
if
self
.
_cache
.
get
(
oid
)
is
not
None
:
if
self
.
_cache
.
get
(
oid
)
is
not
None
:
del
self
.
_cache
[
oid
]
del
self
.
_cache
[
oid
]
...
...
src/ZODB/tests/testZODB.py
View file @
6457bcfd
...
@@ -328,6 +328,49 @@ class ZODBTests(ZODB.tests.util.TestCase):
...
@@ -328,6 +328,49 @@ class ZODBTests(ZODB.tests.util.TestCase):
cn
.
close
()
cn
.
close
()
def
checkSavepointRollbackAndReadCurrent
(
self
):
'''
savepoint rollback after readcurrent of new object should not raise POSKeyError
'''
cn
=
self
.
_db
.
open
()
rt
=
cn
.
root
()
not_modified
=
P
()
not_modified
.
value
=
'not modified'
cn
.
add
(
not_modified
)
rt
[
'not_modified'
]
=
not_modified
not_deleted
=
P
()
cn
.
add
(
not_deleted
)
rt
[
'not_deleted'
]
=
not_deleted
transaction
.
commit
()
self
.
assertTrue
(
'not_modified'
in
rt
)
self
.
assertEquals
(
rt
[
'not_modified'
].
value
,
'not modified'
)
self
.
assertTrue
(
'not_deleted'
in
rt
)
added_before
=
P
()
cn
.
add
(
added_before
)
rt
[
'added_before'
]
=
added_before
sp
=
transaction
.
savepoint
()
not_added
=
P
()
cn
.
add
(
not_added
)
rt
[
'not_added'
]
=
not_added
cn
.
readCurrent
(
rt
[
'not_added'
])
cn
.
readCurrent
(
rt
[
'not_deleted'
])
cn
.
readCurrent
(
rt
[
'not_modified'
])
rt
[
'not_modified'
].
value
=
'modified'
del
rt
[
'not_deleted'
]
self
.
assertTrue
(
'not_added'
in
rt
)
self
.
assertEquals
(
rt
[
'not_modified'
].
value
,
'modified'
)
self
.
assertFalse
(
'not_deleted'
in
rt
)
sp
.
rollback
()
added_after
=
P
()
cn
.
add
(
added_after
)
rt
[
'added_after'
]
=
added_after
transaction
.
commit
()
self
.
assertTrue
(
'added_before'
in
rt
)
self
.
assertFalse
(
'not_added'
in
rt
)
self
.
assertEquals
(
rt
[
'not_modified'
].
value
,
'not modified'
)
self
.
assertTrue
(
'not_deleted'
in
rt
)
self
.
assertTrue
(
'added_after'
in
rt
)
def
checkFailingSavepointSticks
(
self
):
def
checkFailingSavepointSticks
(
self
):
cn
=
self
.
_db
.
open
()
cn
=
self
.
_db
.
open
()
rt
=
cn
.
root
()
rt
=
cn
.
root
()
...
...
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