32 from ZODB import DB |
32 from ZODB import DB |
33 from zope.component import adapter |
33 from zope.component import adapter |
34 from zope.componentvocabulary.vocabulary import UtilityVocabulary |
34 from zope.componentvocabulary.vocabulary import UtilityVocabulary |
35 from zope.container.contained import Contained |
35 from zope.container.contained import Contained |
36 from zope.interface import implementer, implements, classProvides |
36 from zope.interface import implementer, implements, classProvides |
|
37 from zope.schema import getFieldNames |
37 from zope.schema.fieldproperty import FieldProperty |
38 from zope.schema.fieldproperty import FieldProperty |
38 |
39 |
39 # import local packages |
40 # import local packages |
40 |
41 |
41 |
42 |
48 server_port = FieldProperty(IZEOConnection['server_port']) |
49 server_port = FieldProperty(IZEOConnection['server_port']) |
49 storage = FieldProperty(IZEOConnection['storage']) |
50 storage = FieldProperty(IZEOConnection['storage']) |
50 username = FieldProperty(IZEOConnection['username']) |
51 username = FieldProperty(IZEOConnection['username']) |
51 password = FieldProperty(IZEOConnection['password']) |
52 password = FieldProperty(IZEOConnection['password']) |
52 server_realm = FieldProperty(IZEOConnection['server_realm']) |
53 server_realm = FieldProperty(IZEOConnection['server_realm']) |
|
54 |
|
55 def getJSONSettings(self): |
|
56 result = [] |
|
57 for name in getFieldNames(IZEOConnection): |
|
58 result[name] = getattr(self, name) |
|
59 return result |
53 |
60 |
54 def getConnection(self, wait=False, get_storage=False): |
61 def getConnection(self, wait=False, get_storage=False): |
55 """Get a tuple made of storage and DB connection for given settings""" |
62 """Get a tuple made of storage and DB connection for given settings""" |
56 storage = ClientStorage.ClientStorage((str(self.server_name), self.server_port), |
63 storage = ClientStorage.ClientStorage((str(self.server_name), self.server_port), |
57 storage=self.server_storage, |
64 storage=self.server_storage, |