Thank you very much Mike
We just tried this:
session.query(obj.__class__.version).with_for_update().filter(obj.__class__.id
== obj.id).one()
attr['version'] = obj.version
...
But the end result was the same:
IntegrityError: (IntegrityError) duplicate key value violates unique
2014-12-04 19:06:16,938 INFO [root][MainThread]
http://localhost:6543/resources/pages/0001---0002-0001/annotations
2014-12-04 19:06:16,938 INFO [root][MainThread]
http://localhost:6543/resources/pages/0001---0002-0001/annotations
2014-12-04