Do MappingStorage is able to solve conflicts
Éloi Rivard <[email protected]> Fri, 12 Oct 2018 03:02:51 -0700 (PDT)
| Newsgroups | gmane.comp.web.zope.zodb |
|---|---|
| Message-ID | <[email protected]> |
Hi. I have a very simple piece of code with a different behavior depending
on it is running on a MappingStorage or a ClientStorage. Conflicts do not
seem to be solved when I use a MappingStorage.
*import ZODB, transaction, persistentfrom ZEO.ClientStorage import
ClientStorage*
*class MyMapping(persistent.mapping.PersistentMapping): def
_p_resolveConflict(self, old, saved, new): return {"conflict":
"happened"}db = ZODB.DB(None)#db = ZODB.DB(ClientStorage(("localhost",
9999)))with db.transaction() as conn: conn.root.x =
MyMapping()my_transaction_manager = transaction.TransactionManager()conn1 =
db.open(my_transaction_manager)my_transaction_manager.commit()with
db.transaction() as conn2: conn2.root.x["a"] = 1conn1.root.x["b"] =
2my_transaction_manager.commit()*
This piece of code is stupid, but just shows that a conflict is raised with
a MappingStorage, and not with a ClientStorage.
Éloi
--
You received this message because you are subscribed to the Google Groups "zodb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.