Commit e5c1dcd3 authored by Jim Fulton's avatar Jim Fulton

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))
parent 7b08a4bc
......@@ -28,6 +28,13 @@ New Features
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)
......
......@@ -20,3 +20,9 @@ ZEO is now part of ZODB; ZODB's home on the web is
http://www.zope.org/Wikis/ZODB
"""
def DB(*args, **kw):
import ZEO.ClientStorage, ZODB
return ZODB.DB(ZEO.ClientStorage.ClientStorage(*args, **kw))
......@@ -34,23 +34,16 @@ Then we'll start 2 others that use this one:
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()
......
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