Skip to content

Commit

Permalink
Tests pass with zopefoundation/ZODB#66
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim Fulton committed Jun 14, 2016
1 parent c3439c2 commit 40ec019
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 34 deletions.
62 changes: 31 additions & 31 deletions relstorage/__init__.py
Expand Up @@ -30,34 +30,34 @@ def check_compatible():
check_compatible()


def patch_zodb_sync():
"""Patch Connection.sync() and afterCompletion() to pass the 'force' flag.
"""

def _storage_sync(self, *ignored, **kw):
if hasattr(self, '_readCurrent'):
self._readCurrent.clear()
sync = getattr(self._storage, 'sync', 0)
if sync:
# By default, do not force the sync, allowing RelStorage
# to ignore sync requests for a while.
force = kw.get('force', False)
try:
sync(force=force)
except TypeError:
# The 'force' parameter is not accepted.
sync()
self._flush_invalidations()

def sync(self):
"""Manually update the view on the database."""
self.transaction_manager.abort()
self._storage_sync(force=True)

from ZODB.Connection import Connection
Connection._storage_sync = _storage_sync
Connection.afterCompletion = _storage_sync
Connection.newTransaction = _storage_sync
Connection.sync = sync

patch_zodb_sync()
# def patch_zodb_sync():
# """Patch Connection.sync() and afterCompletion() to pass the 'force' flag.
# """

# def _storage_sync(self, *ignored, **kw):
# if hasattr(self, '_readCurrent'):
# self._readCurrent.clear()
# sync = getattr(self._storage, 'sync', 0)
# if sync:
# # By default, do not force the sync, allowing RelStorage
# # to ignore sync requests for a while.
# force = kw.get('force', False)
# try:
# sync(force=force)
# except TypeError:
# # The 'force' parameter is not accepted.
# sync()
# self._flush_invalidations()

# def sync(self):
# """Manually update the view on the database."""
# self.transaction_manager.abort()
# self._storage_sync(force=True)

# from ZODB.Connection import Connection
# Connection._storage_sync = _storage_sync
# Connection.afterCompletion = _storage_sync
# Connection.newTransaction = _storage_sync
# Connection.sync = sync

# patch_zodb_sync()
2 changes: 1 addition & 1 deletion relstorage/storage.py
Expand Up @@ -253,7 +253,7 @@ def _rollback_load_connection(self):
self._load_conn.rollback()
except:
self._drop_load_connection()
raise
#raise
self._load_transaction_open = ''

def _restart_load_and_call(self, f, *args, **kw):
Expand Down
2 changes: 1 addition & 1 deletion relstorage/tests/blob/blob_connection.txt
Expand Up @@ -74,7 +74,7 @@ You can't put blobs into a database that has uses a Non-Blob-Storage, though:
>>> transaction2.commit() # doctest: +ELLIPSIS
Traceback (most recent call last):
...
Unsupported: Storing Blobs in <ZODB.MappingStorage.MappingStorage ...> is not supported.
Unsupported: Storing Blobs in ...

>>> transaction2.abort()
>>> connection2.close()
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -76,7 +76,7 @@ def read_file(*path):
zip_safe=False, # otherwise ZConfig can't see component.xml
install_requires=[
'perfmetrics',
'ZODB >= 4.3.0, <5.0',
'ZODB >= 4.3.0',
# ZEO is needed for blob layout
'ZEO >= 4.2.0b1, <5.0',
'zope.interface',
Expand Down

0 comments on commit 40ec019

Please sign in to comment.