--- 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"""
--- 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),