Commit f8411024 authored by Guido van Rossum's avatar Guido van Rossum

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.
parent 62f870d5
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
############################################################################## ##############################################################################
"""Network ZODB storage client """Network ZODB storage client
$Id: ClientStorage.py,v 1.63 2002/09/19 19:15:48 gvanrossum Exp $ $Id: ClientStorage.py,v 1.64 2002/09/20 13:35:07 gvanrossum Exp $
""" """
# XXX TO DO # XXX TO DO
...@@ -72,9 +72,11 @@ disconnected_stub = DisconnectedServerStub() ...@@ -72,9 +72,11 @@ disconnected_stub = DisconnectedServerStub()
class ClientStorage: class ClientStorage:
def __init__(self, addr, storage='1', cache_size=20000000, 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, 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" % log2(INFO, "ClientStorage (pid=%d) created %s/%s for storage: %r" %
(os.getpid(), (os.getpid(),
...@@ -82,6 +84,24 @@ class ClientStorage: ...@@ -82,6 +84,24 @@ class ClientStorage:
read_only_fallback and "fallback" or "normal", read_only_fallback and "fallback" or "normal",
storage)) 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._addr = addr # For tests
self._server = disconnected_stub self._server = disconnected_stub
self._is_read_only = read_only self._is_read_only = read_only
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment