Commit b1bc8989 authored by Jim Fulton's avatar Jim Fulton

New Features

------------

- As a convenience, you can now pass an integer port as an address to
  the ZEO ClientStorage constructor.

- As a convenience, there's a new ``client`` function in the ZEO
  package for constructing a ClientStorage instance.  It takes the
  same arguments as the ClientStorage constructor.
parent 41c7d6f7
...@@ -34,6 +34,13 @@ New Features ...@@ -34,6 +34,13 @@ New Features
- Broken objects now provide the IBroken interface. - Broken objects now provide the IBroken interface.
- As a convenience, you can now pass an integer port as an address to
the ZEO ClientStorage constructor.
- As a convenience, there's a new ``client`` function in the ZEO
package for constructing a ClientStorage instance. It takes the
same arguments as the ClientStorage constructor.
Bugs Fixed Bugs Fixed
---------- ----------
......
...@@ -240,6 +240,9 @@ class ClientStorage(object): ...@@ -240,6 +240,9 @@ class ClientStorage(object):
""" """
if isinstance(addr, int):
addr = '127.0.0.1', addr
self.__name__ = name or str(addr) # Standard convention for storages self.__name__ = name or str(addr) # Standard convention for storages
logger.info( logger.info(
......
...@@ -31,6 +31,10 @@ def connection(*args, **kw): ...@@ -31,6 +31,10 @@ def connection(*args, **kw):
conn.onCloseCallback(db.close) conn.onCloseCallback(db.close)
return conn return conn
def client(*args, **kw):
import ZEO.ClientStorage
return ZEO.ClientStorage.ClientStorage(*args, **kw)
def server(path=None, blob_dir=None, storage_conf=None, zeo_conf=None, def server(path=None, blob_dir=None, storage_conf=None, zeo_conf=None,
port=None): port=None):
"""Convenience function to start a server for interactive exploration """Convenience function to start a server for interactive exploration
......
...@@ -1256,6 +1256,16 @@ Invalidations could cause errors when closing client storages, ...@@ -1256,6 +1256,16 @@ Invalidations could cause errors when closing client storages,
>>> thread.join(1) >>> thread.join(1)
""" """
def convenient_to_pass_port_to_client_and_ZEO_dot_client():
"""Jim hates typing
>>> addr, _ = start_server()
>>> client = ZEO.client(addr[1])
>>> client.__name__ == "('127.0.0.1', %s)" % addr[1]
True
>>> client.close()
"""
if sys.version_info >= (2, 6): if sys.version_info >= (2, 6):
......
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