Commit 114dd15d authored by Albertas Agejevas's avatar Albertas Agejevas

Fix weird namespace behavior incompatibilities between Py2 and Py3.

parent ae387e60
...@@ -602,7 +602,8 @@ class ZEOStorage: ...@@ -602,7 +602,8 @@ class ZEOStorage:
self.storage.deleteObject(oid, serial, self.transaction) self.storage.deleteObject(oid, serial, self.transaction)
except (SystemExit, KeyboardInterrupt): except (SystemExit, KeyboardInterrupt):
raise raise
except Exception as err: except Exception as e:
err = e
self._op_error(oid, err, 'delete') self._op_error(oid, err, 'delete')
return err is None return err is None
...@@ -614,7 +615,8 @@ class ZEOStorage: ...@@ -614,7 +615,8 @@ class ZEOStorage:
oid, serial, self.transaction) oid, serial, self.transaction)
except (SystemExit, KeyboardInterrupt): except (SystemExit, KeyboardInterrupt):
raise raise
except Exception as err: except Exception as e:
err = e
self._op_error(oid, err, 'checkCurrentSerialInTransaction') self._op_error(oid, err, 'checkCurrentSerialInTransaction')
return err is None return err is None
...@@ -669,7 +671,8 @@ class ZEOStorage: ...@@ -669,7 +671,8 @@ class ZEOStorage:
tid, oids = self.storage.undo(trans_id, self.transaction) tid, oids = self.storage.undo(trans_id, self.transaction)
except (SystemExit, KeyboardInterrupt): except (SystemExit, KeyboardInterrupt):
raise raise
except Exception as err: except Exception as e:
err = e
self._op_error(z64, err, 'undo') self._op_error(z64, err, 'undo')
else: else:
self.invalidated.extend(oids) self.invalidated.extend(oids)
...@@ -681,12 +684,12 @@ class ZEOStorage: ...@@ -681,12 +684,12 @@ class ZEOStorage:
# Try to pickle the exception. If it can't be pickled, # Try to pickle the exception. If it can't be pickled,
# the RPC response would fail, so use something that can be pickled. # the RPC response would fail, so use something that can be pickled.
if PY3: if PY3:
pickler = Pickler(BytesIO(), 1) pickler = Pickler(BytesIO(), 3)
else: else:
pickler = Pickler() pickler = Pickler()
pickler.fast = 1 pickler.fast = 1
try: try:
pickler.dump(error, 1) pickler.dump(error)
except: except:
msg = "Couldn't pickle storage exception: %s" % repr(error) msg = "Couldn't pickle storage exception: %s" % repr(error)
self.log(msg, logging.ERROR) self.log(msg, logging.ERROR)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment