Commit c35f2528 authored by Jason Madden's avatar Jason Madden

Rollback some changes now that Python persistent handles registering objects...

Rollback some changes now that Python persistent handles registering objects during __setstate__ the same way as C persistent.
parent b25eb532
......@@ -2,6 +2,7 @@ language: python
sudo: false
python:
- pypy
- pypy3
- 2.6
- 2.7
- 3.2
......
......@@ -76,14 +76,7 @@ class Blob(persistent.Persistent):
_p_blob_committed = None # Filename of the committed data
_p_blob_ref = None # weakreference to self; also in _blob_close_refs
# Use volatile attributes so as not to spuriously mark as changed.
# The properties are aliases for BWC
readers = property(lambda self: getattr(self, '_v_readers', None),
lambda self, nv: setattr(self, '_v_readers', nv))
writers = property(lambda self: getattr(self, '_v_writers', None),
lambda self, nv: setattr(self, '_v_writers', nv))
_v_readers = None
_v_writers = None
readers = writers = None
def __init__(self, data=None):
# Raise exception if Blobs are getting subclassed
......@@ -98,14 +91,8 @@ class Blob(persistent.Persistent):
def __setstate__(self, state=None):
# we use lists here because it will allow us to add and remove
# atomically
# Directly use the volatile attributes here, not the property,
# because setting the property causes us to get marked as changed,
# which registers us with the Connection and hence the transaction;
# at least under the Python implementation of persistent this causes
# duplicate transaction errors from the storage in testblob.
# Plus this way is more efficient anyway :)
self._v_readers = []
self._v_writers = []
self.readers = []
self.writers = []
def __getstate__(self):
return None
......@@ -164,8 +151,8 @@ class Blob(persistent.Persistent):
if self.writers:
raise BlobError("Already opened for writing.")
if self._v_readers is None:
self._v_readers = []
if self.readers is None:
self.readers = []
if mode == 'r':
result = None
......
......@@ -177,7 +177,6 @@ def _functest_load(fqn):
# Open the database and attempt to deserialize the tree
# (run in separate process)
from ZODB import DB
import transaction
WORKING, FAILING = _working_failing_datetimes()
db = DB(fqn)
conn = db.open()
......@@ -186,7 +185,6 @@ def _functest_load(fqn):
tree = root['tree']
assert tree[WORKING] == 'working'
assert tree[FAILING] == 'failing'
transaction.abort()
finally: # Windoze
conn.close()
db.close()
......
......@@ -52,7 +52,7 @@ class RegularObject(Persistent):
class PersistentObject(Persistent):
pass
class CacheTests(object):
class CacheTests:
def test_cache(self):
r"""Test basic cache methods.
......
[tox]
envlist = py26,py27,py32,py33,py34,pypy,simple
envlist = py26,py27,py32,py33,py34,pypy,simple,pypy3
[testenv]
commands =
......
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