Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

  • Loading branch information...
commit 6b6c006e8d9ec899587165277b74a409a52f4773 1 parent 46a27c1
Asko Soukka authored April 25, 2012
16  sauna/reload/adapters.py
@@ -21,7 +21,6 @@
21 21
 from zope.component import adapts
22 22
 
23 23
 from ZODB.interfaces import IDatabase
24  
-from ZODB.blob import BlobStorage
25 24
 from ZODB.FileStorage.FileStorage import FileStorage, read_index
26 25
 from ZEO.ClientStorage import ClientStorage
27 26
 
@@ -94,21 +93,6 @@ def resumeFromReload(self):
94 93
             self.context._lock_release()
95 94
 
96 95
 
97  
-class ZODBBlobStorageDatabaseHooksAdapter(ZODBFileStorageDatabaseHooksAdapter):
98  
-    """
99  
-    BlogStorage-proxied FileStorage-adapter
100  
-    """
101  
-    implements(IDatabaseHooks)
102  
-    adapts(BlobStorage)
103  
-
104  
-    def __init__(self, context):
105  
-        # Try to get the *real* FileStorage,
106  
-        # because `context` may be just a BlobStorage-wrapper
107  
-        # and it wraps FileStorage differently between
108  
-        # ZODB3-3.9.5 and 3.10.x-series (eg. between Plone 4.0 and 4.1).
109  
-        self.context = getattr(context, '_BlobStorage__storage', context)
110  
-
111  
-
112 96
 class ZEOClientStorageDatabaseHooksAdapter(object):
113 97
     """
114 98
     ZEO-client adapter
9  sauna/reload/configure.zcml
@@ -2,9 +2,16 @@
2 2
     xmlns="http://namespaces.zope.org/zope"
3 3
     xmlns:browser="http://namespaces.zope.org/browser">
4 4
 
  5
+    <!-- Generic adapter to adapt both FileStorage and ZEO ClientStorage -->
5 6
     <adapter factory=".adapters.ZODBDatabaseHooksAdapter" />
  7
+    <!-- FileStorage-adapter adapts to FileStorage on Plone >= 4.0
  8
+         and also to BlobsStorage on Plone >= 4.1 -->
6 9
     <adapter factory=".adapters.ZODBFileStorageDatabaseHooksAdapter" />
7  
-    <adapter factory=".adapters.ZODBBlobStorageDatabaseHooksAdapter" />
  10
+    <!-- Re-registered adapter is required to adapt BlobStorage
  11
+         on Plone >= 4.0.x, < 4.1 -->
  12
+    <adapter factory=".adapters.ZODBFileStorageDatabaseHooksAdapter"
  13
+             for="ZODB.blob.BlobStorage" />
  14
+    <!-- ClientStorage-adapter adapts to ZEO ClientStorage on Plone >= 4.1 -->
8 15
     <adapter factory=".adapters.ZEOClientStorageDatabaseHooksAdapter" />
9 16
 
10 17
     <subscriber

0 notes on commit 6b6c006

Please sign in to comment.
Something went wrong with that request. Please try again.