[Zodb-checkins] SVN: ZODB/trunk/src/ New Features

Jim Fulton jim at zope.com
Wed Feb 3 15:58:31 EST 2010


Log message for revision 108738:
  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.
  

Changed:
  U   ZODB/trunk/src/CHANGES.txt
  U   ZODB/trunk/src/ZEO/ClientStorage.py
  U   ZODB/trunk/src/ZEO/__init__.py
  U   ZODB/trunk/src/ZEO/tests/testZEO.py

-=-
Modified: ZODB/trunk/src/CHANGES.txt
===================================================================
--- ZODB/trunk/src/CHANGES.txt	2010-02-03 17:37:29 UTC (rev 108737)
+++ ZODB/trunk/src/CHANGES.txt	2010-02-03 20:58:30 UTC (rev 108738)
@@ -34,6 +34,13 @@
 
 - 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
 ----------
 

Modified: ZODB/trunk/src/ZEO/ClientStorage.py
===================================================================
--- ZODB/trunk/src/ZEO/ClientStorage.py	2010-02-03 17:37:29 UTC (rev 108737)
+++ ZODB/trunk/src/ZEO/ClientStorage.py	2010-02-03 20:58:30 UTC (rev 108738)
@@ -240,6 +240,9 @@
 
         """
 
+        if isinstance(addr, int):
+            addr = '127.0.0.1', addr
+
         self.__name__ = name or str(addr) # Standard convention for storages
 
         logger.info(

Modified: ZODB/trunk/src/ZEO/__init__.py
===================================================================
--- ZODB/trunk/src/ZEO/__init__.py	2010-02-03 17:37:29 UTC (rev 108737)
+++ ZODB/trunk/src/ZEO/__init__.py	2010-02-03 20:58:30 UTC (rev 108738)
@@ -31,6 +31,10 @@
     conn.onCloseCallback(db.close)
     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,
            port=None):
     """Convenience function to start a server for interactive exploration

Modified: ZODB/trunk/src/ZEO/tests/testZEO.py
===================================================================
--- ZODB/trunk/src/ZEO/tests/testZEO.py	2010-02-03 17:37:29 UTC (rev 108737)
+++ ZODB/trunk/src/ZEO/tests/testZEO.py	2010-02-03 20:58:30 UTC (rev 108738)
@@ -1256,8 +1256,18 @@
     >>> 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):
     import multiprocessing
 



More information about the Zodb-checkins mailing list