--- a/src/pyams_utils/zodb.py Wed Mar 11 12:22:22 2015 +0100
+++ b/src/pyams_utils/zodb.py Wed Mar 11 12:22:50 2015 +0100
@@ -29,6 +29,7 @@
from persistent import Persistent
from pyams_utils.adapter import adapter_config
from pyramid.events import subscriber
+from pyramid_zodbconn import get_uris, db_from_uri
from ZEO import ClientStorage
from ZODB import DB
from zope.componentvocabulary.vocabulary import UtilityVocabulary
@@ -156,3 +157,10 @@
nameOnly = True
getVocabularyRegistry().register('PyAMS ZEO connections', ZEOConnectionVocabulary)
+
+
+def get_connection_from_settings(settings):
+ """Load connection matching registry settings"""
+ for name, uri in get_uris(settings):
+ db = db_from_uri(uri, name, {})
+ return db.open()