Commit 24ab25d2 authored by Guido van Rossum's avatar Guido van Rossum

ZEOStorage cleanliness nits:

- It never uses self.conn.  So don't store it.

- Make a check in register() that register() isn't called twice.  If
  it is, log a message and raise ValueError.
parent ca6e3d30
......@@ -120,13 +120,11 @@ class ZEOStorage:
def __init__(self, server):
self.server = server
self.client = None
self.conn = None # the connection associated with client
self.storage = None
self.storage_id = "uninitialized"
self.transaction = None
def notifyConnected(self, conn):
self.conn = conn
self.client = ClientStub.ClientStorage(conn)
def notifyDisconnected(self):
......@@ -187,6 +185,9 @@ class ZEOStorage:
This method must be the first one called by the client.
"""
self.log("register(%r, %s)" % (storage_id, read_only))
if self.storage is not None:
log("duplicate register() call")
raise ValueError, "duplicate register() call"
storage = self.server.storages.get(storage_id)
if storage is None:
self.log("unknown storage_id: %s" % storage_id)
......
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