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
Joshua
zodb
Commits
220c35b3
Commit
220c35b3
authored
Sep 22, 2010
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added test to verify
https://bugs.launchpad.net/zodb/+bug/485456
parent
8c52bb2b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
0 deletions
+64
-0
src/ZODB/tests/testConnection.py
src/ZODB/tests/testConnection.py
+64
-0
No files found.
src/ZODB/tests/testConnection.py
View file @
220c35b3
...
...
@@ -847,6 +847,70 @@ False
>>> c.close()
"""
class
Clp485456_setattr_in_getstate_doesnt_cause_multiple_stores
(
Persistent
):
def
__getstate__
(
self
):
self
.
got
=
1
return
self
.
__dict__
.
copy
()
def
lp485456_setattr_in_setstate_doesnt_cause_multiple_stores
():
r"""
>>> C = Clp485456_setattr_in_getstate_doesnt_cause_multiple_stores
>>> conn = ZODB.connection(None)
>>> oldstore = conn._storage.store
>>> def store(oid, *args):
... print 'storing', repr(oid)
... return oldstore(oid, *args)
>>> conn._storage.store = store
When we commit a change, we only get a single store call
>>> conn.root.x = C()
>>> transaction.commit()
storing '\x00\x00\x00\x00\x00\x00\x00\x00'
storing '\x00\x00\x00\x00\x00\x00\x00\x01'
>>> conn.add(C())
>>> transaction.commit()
storing '\x00\x00\x00\x00\x00\x00\x00\x02'
We still see updates:
>>> conn.root.x.y = 1
>>> transaction.commit()
storing '\x00\x00\x00\x00\x00\x00\x00\x01'
Not not non-updates:
>>> transaction.commit()
Let's try some combinations with savepoints:
>>> conn.root.n = 0
>>> _ = transaction.savepoint()
>>> oldspstore = conn._storage.store
>>> def store(oid, *args):
... print 'savepoint storing', repr(oid)
... return oldspstore(oid, *args)
>>> conn._storage.store = store
>>> conn.root.y = C()
>>> _ = transaction.savepoint()
savepoint storing '\x00\x00\x00\x00\x00\x00\x00\x00'
savepoint storing '\x00\x00\x00\x00\x00\x00\x00\x03'
>>> conn.root.y.x = 1
>>> _ = transaction.savepoint()
savepoint storing '\x00\x00\x00\x00\x00\x00\x00\x03'
>>> transaction.commit()
storing '\x00\x00\x00\x00\x00\x00\x00\x00'
storing '\x00\x00\x00\x00\x00\x00\x00\x03'
>>> conn.close()
"""
class
_PlayPersistent
(
Persistent
):
def
setValueWithSize
(
self
,
size
=
0
):
self
.
value
=
size
*
' '
__init__
=
setValueWithSize
...
...
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