[Zodb-checkins] SVN: ZODB/branches/jim-dev/src/ZODB/DB.py Added a deprecation warning for not having tpc_vote.

Jim Fulton jim at zope.com
Sun May 14 13:55:08 EDT 2006


Log message for revision 68127:
  Added a deprecation warning for not having tpc_vote.
  
  Added vertical whitespace for readability.
  

Changed:
  U   ZODB/branches/jim-dev/src/ZODB/DB.py

-=-
Modified: ZODB/branches/jim-dev/src/ZODB/DB.py
===================================================================
--- ZODB/branches/jim-dev/src/ZODB/DB.py	2006-05-14 17:55:03 UTC (rev 68126)
+++ ZODB/branches/jim-dev/src/ZODB/DB.py	2006-05-14 17:55:07 UTC (rev 68127)
@@ -15,6 +15,8 @@
 
 $Id$"""
 
+import warnings
+
 import cPickle, cStringIO, sys
 import threading
 from time import time, ctime
@@ -231,11 +233,21 @@
 
         # Setup storage
         self._storage=storage
+
         storage.registerDB(self, None)
+
         if not hasattr(storage,'tpc_vote'):
+            warnings.warn(
+                "Storage doesn't have a tpc_vote and this violates "
+                "the stirage API. Violently monkeypatching in a do-nothing "
+                "tpc_vote.",
+                DeprecationWarning, 2)
             storage.tpc_vote = lambda *args: None
+            
+
         try:
             storage.load(z64,'')
+
         except KeyError:
             # Create the database's root in the storage if it doesn't exist
             from persistent.mapping import PersistentMapping



More information about the Zodb-checkins mailing list