[Zodb-checkins] CVS: ZODB3/ZEO - ClientStorage.py:1.64

Guido van Rossum guido@python.org
Fri, 20 Sep 2002 09:35:08 -0400


Update of /cvs-repository/ZODB3/ZEO
In directory cvs.zope.org:/tmp/cvs-serv12059

Modified Files:
	ClientStorage.py 
Log Message:
Address Chris McDonough's request: make the ClientStorage()
constructor signature backwards compatible with ZEO 1.  This means
adding wait_for_server_on_startup and debug options.
wait_for_server_on_startup is an alias for wait, which makes the
argument decoding for these two a little tricky.  debug is ignored.

Also change the default of wait to True, like it was in ZEO 1.  This
is less likely to screw naive customers.


=== ZODB3/ZEO/ClientStorage.py 1.63 => 1.64 ===
--- ZODB3/ZEO/ClientStorage.py:1.63	Thu Sep 19 15:15:48 2002
+++ ZODB3/ZEO/ClientStorage.py	Fri Sep 20 09:35:07 2002
@@ -72,15 +72,35 @@
 class ClientStorage:
 
     def __init__(self, addr, storage='1', cache_size=20000000,
-                 name='', client=None, var=None,
+                 name='', client=None, debug=0, var=None,
                  min_disconnect_poll=5, max_disconnect_poll=300,
-                 wait=0, read_only=0, read_only_fallback=0):
+                 wait_for_server_on_startup=None, # deprecated alias for wait
+                 wait=None, # defaults to 1
+                 read_only=0, read_only_fallback=0):
 
         log2(INFO, "ClientStorage (pid=%d) created %s/%s for storage: %r" %
              (os.getpid(),
               read_only and "RO" or "RW",
               read_only_fallback and "fallback" or "normal",
               storage))
+
+        if debug:
+            log2(INFO, "ClientStorage(): debug argument is no longer used")
+
+        # wait defaults to True, but wait_for_server_on_startup overrides
+        # if not None
+        if wait_for_server_on_startup is not None:
+            if wait is not None and wait != wait_for_server_on_startup:
+                log2(PROBLEM,
+                     "ClientStorage(): conflicting values for wait and "
+                     "wait_for_server_on_startup; wait prevails")
+            else:
+                log2(INFO,
+                     "ClientStorage(): wait_for_server_on_startup "
+                     "is deprecated; please use wait instead")
+                wait = wait_for_server_on_startup
+        elif wait is None:
+            wait = 1
 
         self._addr = addr # For tests
         self._server = disconnected_stub