[Zodb-checkins] SVN: ZODB/trunk/src/ Added a new convenience function, ZEO.DB, for creating databases

Jim Fulton jim at zope.com
Thu Nov 6 18:05:55 EST 2008


Log message for revision 92822:
  Added a new convenience function, ZEO.DB, for creating databases
  using ZEO Client Storages.  Just call ZEO.DB with the same arguments
  you would otherwise pass to ZEO.ClientStorage.ClientStorage::
  
  import ZEO
    db = ZEO.DB(('some_host', 8200))
  

Changed:
  U   ZODB/trunk/src/CHANGES.txt
  U   ZODB/trunk/src/ZEO/__init__.py
  U   ZODB/trunk/src/ZEO/tests/zeo-fan-out.test

-=-
Modified: ZODB/trunk/src/CHANGES.txt
===================================================================
--- ZODB/trunk/src/CHANGES.txt	2008-11-06 22:52:23 UTC (rev 92821)
+++ ZODB/trunk/src/CHANGES.txt	2008-11-06 23:05:55 UTC (rev 92822)
@@ -28,6 +28,13 @@
 New Features
 ------------
 
+- There's a new convenience function, ZEO.DB, for creating databases
+  using ZEO Client Storages.  Just call ZEO.DB with the same arguments
+  you would otherwise pass to ZEO.ClientStorage.ClientStorage::
+
+    import ZEO
+    db = ZEO.DB(('some_host', 8200)) 
+
 - Object saves are a little faster
 
 3.9.0a4 (2008-11-06)

Modified: ZODB/trunk/src/ZEO/__init__.py
===================================================================
--- ZODB/trunk/src/ZEO/__init__.py	2008-11-06 22:52:23 UTC (rev 92821)
+++ ZODB/trunk/src/ZEO/__init__.py	2008-11-06 23:05:55 UTC (rev 92822)
@@ -20,3 +20,9 @@
     http://www.zope.org/Wikis/ZODB
 
 """
+
+def DB(*args, **kw):
+    import ZEO.ClientStorage, ZODB
+    return ZODB.DB(ZEO.ClientStorage.ClientStorage(*args, **kw))
+
+    

Modified: ZODB/trunk/src/ZEO/tests/zeo-fan-out.test
===================================================================
--- ZODB/trunk/src/ZEO/tests/zeo-fan-out.test	2008-11-06 22:52:23 UTC (rev 92821)
+++ ZODB/trunk/src/ZEO/tests/zeo-fan-out.test	2008-11-06 23:05:55 UTC (rev 92822)
@@ -34,23 +34,16 @@
 
 Now, let's create some client storages that connect to these:
 
-    >>> import ZEO.ClientStorage
-    >>> cs1 = ZEO.ClientStorage.ClientStorage(('localhost', port1), '1')
-    >>> cs2 = ZEO.ClientStorage.ClientStorage(('localhost', port2), '1')
+    >>> import ZEO, transaction
 
-And some databases and connections around these:
-
-    >>> from ZODB.DB import DB
-    >>> import transaction
-
-    >>> db1 = DB(cs1)
+    >>> db1 = ZEO.DB(('localhost', port1), '1')
     >>> tm1 = transaction.TransactionManager()
     >>> c1 = db1.open(transaction_manager=tm1)
     >>> r1 = c1.root()
     >>> r1
     {}
 
-    >>> db2 = DB(cs2)
+    >>> db2 = ZEO.DB(('localhost', port2), '1')
     >>> tm2 = transaction.TransactionManager()
     >>> c2 = db2.open(transaction_manager=tm2)
     >>> r2 = c2.root()



More information about the Zodb-checkins mailing list