Permalink
Browse files

Refactored database-adapters. Added comments on adapter-registrations.

  • Loading branch information...
datakurre committed Apr 25, 2012
1 parent 46a27c1 commit 6b6c006e8d9ec899587165277b74a409a52f4773
Showing with 8 additions and 17 deletions.
  1. +0 −16 sauna/reload/adapters.py
  2. +8 −1 sauna/reload/configure.zcml
View
@@ -21,7 +21,6 @@
from zope.component import adapts
from ZODB.interfaces import IDatabase
-from ZODB.blob import BlobStorage
from ZODB.FileStorage.FileStorage import FileStorage, read_index
from ZEO.ClientStorage import ClientStorage
@@ -94,21 +93,6 @@ def resumeFromReload(self):
self.context._lock_release()
-class ZODBBlobStorageDatabaseHooksAdapter(ZODBFileStorageDatabaseHooksAdapter):
- """
- BlogStorage-proxied FileStorage-adapter
- """
- implements(IDatabaseHooks)
- adapts(BlobStorage)
-
- def __init__(self, context):
- # Try to get the *real* FileStorage,
- # because `context` may be just a BlobStorage-wrapper
- # and it wraps FileStorage differently between
- # ZODB3-3.9.5 and 3.10.x-series (eg. between Plone 4.0 and 4.1).
- self.context = getattr(context, '_BlobStorage__storage', context)
-
-
class ZEOClientStorageDatabaseHooksAdapter(object):
"""
ZEO-client adapter
@@ -2,9 +2,16 @@
xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser">
+ <!-- Generic adapter to adapt both FileStorage and ZEO ClientStorage -->
<adapter factory=".adapters.ZODBDatabaseHooksAdapter" />
+ <!-- FileStorage-adapter adapts to FileStorage on Plone >= 4.0
+ and also to BlobsStorage on Plone >= 4.1 -->
<adapter factory=".adapters.ZODBFileStorageDatabaseHooksAdapter" />
- <adapter factory=".adapters.ZODBBlobStorageDatabaseHooksAdapter" />
+ <!-- Re-registered adapter is required to adapt BlobStorage
+ on Plone >= 4.0.x, < 4.1 -->
+ <adapter factory=".adapters.ZODBFileStorageDatabaseHooksAdapter"
+ for="ZODB.blob.BlobStorage" />
+ <!-- ClientStorage-adapter adapts to ZEO ClientStorage on Plone >= 4.1 -->
<adapter factory=".adapters.ZEOClientStorageDatabaseHooksAdapter" />
<subscriber

0 comments on commit 6b6c006

Please sign in to comment.