Commit 207efabe authored by Guido van Rossum's avatar Guido van Rossum

Fix argument passing to the storage factory in winserver.

This code used to assume that all arguments were strings.
It was always wrong (create was passed as '0' or '1' rather
than as 0 or 1) but this was somehow masked.  When I added
readonly, things broke.  The solution is that winserver.py
ha a convention that an argument starting with '=' is
evaluated as an expression, and _startserver in testZEO's
WindowsConnectionText uses this for the create and readonly
args.
parent e66bb7a3
......@@ -508,8 +508,9 @@ class WindowsConnectionTests(ConnectionTests):
def _startServer(self, create=1, index=0, read_only=0):
path = "%s.%d" % (self.file, index)
addr = self.addr[index]
args = (path, '='+str(create), '='+str(read_only))
_addr, test_addr, test_pid = forker.start_zeo_server(
'FileStorage', (path, str(create), read_only), addr)
'FileStorage', args, addr)
self._pids.append(test_pid)
self._servers.append(test_addr)
......
......@@ -50,8 +50,13 @@ def load_storage_class(name):
mod = getattr(package, name)
return getattr(mod, name)
def main(port, storage_name, args):
def main(port, storage_name, rawargs):
klass = load_storage_class(storage_name)
args = []
for arg in rawargs:
if arg.startswith('='):
arg = eval(arg[1:], {'__builtins__': {}})
args.append(arg)
storage = klass(*args)
zeo_port = int(port)
test_port = zeo_port + 1
......
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