# HG changeset patch # User Thierry Florac # Date 1348183088 -7200 # Node ID 0e8925323082d79a3558c99f7574e4774ba9d224 # Parent a08e9a1c5b07897e0f8a7f50e5460af270ac87ee Get ZEO connection settings as JSON object diff -r a08e9a1c5b07 -r 0e8925323082 src/ztfy/utils/interfaces.py --- a/src/ztfy/utils/interfaces.py Thu Sep 20 19:13:01 2012 +0200 +++ b/src/ztfy/utils/interfaces.py Fri Sep 21 01:18:08 2012 +0200 @@ -179,5 +179,8 @@ description=_("Realm name on ZEO server"), required=False) + def getJSONSettings(self): + """Get ZEO connection setting as a JSON dict""" + def getConnection(self, wait=False): """Open ZEO connection with given settings""" diff -r a08e9a1c5b07 -r 0e8925323082 src/ztfy/utils/zodb.py --- a/src/ztfy/utils/zodb.py Thu Sep 20 19:13:01 2012 +0200 +++ b/src/ztfy/utils/zodb.py Fri Sep 21 01:18:08 2012 +0200 @@ -34,6 +34,7 @@ from zope.componentvocabulary.vocabulary import UtilityVocabulary from zope.container.contained import Contained from zope.interface import implementer, implements, classProvides +from zope.schema import getFieldNames from zope.schema.fieldproperty import FieldProperty # import local packages @@ -51,6 +52,12 @@ password = FieldProperty(IZEOConnection['password']) server_realm = FieldProperty(IZEOConnection['server_realm']) + def getJSONSettings(self): + result = [] + for name in getFieldNames(IZEOConnection): + result[name] = getattr(self, name) + return result + def getConnection(self, wait=False, get_storage=False): """Get a tuple made of storage and DB connection for given settings""" storage = ClientStorage.ClientStorage((str(self.server_name), self.server_port),