Commit fcfee0d3 authored by Jim Fulton's avatar Jim Fulton

Renamed DB.open to connection

parent a7017469
...@@ -25,15 +25,12 @@ def DB(*args, **kw): ...@@ -25,15 +25,12 @@ def DB(*args, **kw):
import ZEO.ClientStorage, ZODB import ZEO.ClientStorage, ZODB
return ZODB.DB(ZEO.ClientStorage.ClientStorage(*args, **kw)) return ZODB.DB(ZEO.ClientStorage.ClientStorage(*args, **kw))
def open(*args, **kw): def connection(*args, **kw):
db = DB(*args, **kw) db = DB(*args, **kw)
conn = db.open() conn = db.open()
conn.onCloseCallback(db.close) conn.onCloseCallback(db.close)
return conn return conn
DB.open = open
del open
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
......
...@@ -1156,7 +1156,7 @@ def open_convenience(): ...@@ -1156,7 +1156,7 @@ def open_convenience():
"""Often, we just want to open a single connection. """Often, we just want to open a single connection.
>>> addr, _ = start_server(path='data.fs') >>> addr, _ = start_server(path='data.fs')
>>> conn = ZEO.DB.open(addr) >>> conn = ZEO.connection(addr)
>>> conn.root() >>> conn.root()
{} {}
......
...@@ -25,4 +25,4 @@ sys.modules['ZODB.PersistentList'] = sys.modules['persistent.list'] ...@@ -25,4 +25,4 @@ sys.modules['ZODB.PersistentList'] = sys.modules['persistent.list']
del mapping, list, sys del mapping, list, sys
from DB import DB from DB import DB, connection
...@@ -164,7 +164,7 @@ def passing_a_file_name_to_DB(): ...@@ -164,7 +164,7 @@ def passing_a_file_name_to_DB():
def open_convenience(): def open_convenience():
"""Often, we just want to open a single connection. """Often, we just want to open a single connection.
>>> conn = ZODB.DB.open('data.fs') >>> conn = ZODB.connection('data.fs')
>>> conn.root() >>> conn.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