SVN: ZODB/trunk/src/ New Features

Jim Fulton <[email protected]>
Newsgroups gmane.comp.python.zope.zodb.cvs
Message-ID <20100203205831.07771941AF__33972.4516649314$1265230726$gmane$org@cvs.zope.org>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.