Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sebastien Robin
erp5
Commits
77f9030e
Commit
77f9030e
authored
12 years ago
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DemoStorage: update conflict resolution patch for ZODB 3.10
parent
4718f5e1
master
equivalence_tester_explanation
folder_optimization
lowest_value_test
master_w
mic_construction_update_sr
old_prod_w
prod_w
relationfield_keyboard_menu
seb_backup
seb_cloudooo
seb_project
seb_wf
solver_fixup
task_planning_app
testnode
workflow
workflow_backup
workflow_cleaned
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
32 deletions
+15
-32
product/ERP5Type/patches/DemoStorage.py
product/ERP5Type/patches/DemoStorage.py
+15
-32
No files found.
product/ERP5Type/patches/DemoStorage.py
View file @
77f9030e
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# Copyright (c) 2010 Nexedi SARL and Contributors. All Rights Reserved.
# All Rights Reserved.
# Copyright (c) 2010-2013 Nexedi SARL 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.
...
...
@@ -13,43 +12,27 @@
#
##############################################################################
from
ZODB.DemoStorage
import
DemoStorage
from
ZODB.ConflictResolution
import
tryToResolveConflict
,
ResolvedSerial
from
ZODB
import
DemoStorage
as
_DemoStorage
from
ZODB.ConflictResolution
import
ConflictResolvingStorage
,
ResolvedSerial
from
ZODB.POSException
import
ConflictError
if
1
:
assert
not
issubclass
(
_DemoStorage
.
DemoStorage
,
ConflictResolvingStorage
)
class
DemoStorage
(
_DemoStorage
.
DemoStorage
,
ConflictResolvingStorage
):
##
# Implement conflict resolution for DemoStorage
#
import
ZODB.POSException
def
store
(
self
,
oid
,
serial
,
data
,
version
,
transaction
):
assert
version
==
''
,
"versions aren't supported"
if
transaction
is
not
self
.
_transaction
:
raise
ZODB
.
POSException
.
StorageTransactionError
(
self
,
transaction
)
# Since the OID is being used, we don't have to keep up with it any
# more. Save it now so we can forget it later. :)
self
.
_stored_oids
.
add
(
oid
)
# See if we already have changes for this oid
try
:
old
=
self
.
changes
.
load
(
oid
,
''
)[
1
]
except
ZODB
.
POSException
.
POSKeyError
:
try
:
old
=
self
.
base
.
load
(
oid
,
''
)[
1
]
except
ZODB
.
POSException
.
POSKeyError
:
old
=
serial
if
old
!=
serial
:
# <patch>
rdata
=
tryToResolveConflict
(
self
,
oid
,
old
,
serial
,
data
)
if
rdata
is
None
:
raise
ZODB
.
POSException
.
ConflictError
(
oid
=
oid
,
serials
=
(
old
,
serial
),
data
=
data
)
return
super
(
DemoStorage
,
self
).
store
(
oid
,
serial
,
data
,
version
,
transaction
)
except
ConflictError
,
e
:
old
=
e
.
serials
[
0
]
rdata
=
self
.
tryToResolveConflict
(
oid
,
old
,
serial
,
data
)
if
rdata
is
None
:
# BBB: Zope < 2.13
raise
ConflictError
(
oid
=
oid
,
serials
=
(
old
,
serial
),
data
=
data
)
self
.
changes
.
store
(
oid
,
old
,
rdata
,
''
,
transaction
)
return
ResolvedSerial
# </patch>
return
self
.
changes
.
store
(
oid
,
serial
,
data
,
''
,
transaction
)
DemoStorage
.
store
=
stor
e
_DemoStorage
.
DemoStorage
=
DemoStorag
e
This diff is collapsed.
Click to expand it.
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