[Zope] reading zope.config file for ClientStorage

Mika, David P (Research) mika at crd.ge.com
Fri Oct 7 16:13:04 EDT 2005


To initialize ZEO clients with ClientStorage I need info such as host, port, etc.  All the needed stuff is tucked away nicely in the zope.config file and I would like to be using the zope machinery access it.  I know that what I need is in there somewhere, but when I try to follow how it happens in say the Zope startup, I get lost in all the dependencies and my head starts swirling.  

I would like to be able to use something like is in ZODB/config.py:

	class ZEOClient(BaseConfig):

	    def open(self):
	        from ZEO.ClientStorage import ClientStorage
	        # config.server is a multikey of socket-address values
	        # where the value is a socket family, address tuple.
	        L = [server.address for server in self.config.server]
	        return ClientStorage(
	            L,
	            storage=self.config.storage,
	            cache_size=self.config.cache_size,
	            name=self.config.name,
	            client=self.config.client,
	            var=self.config.var,
	            min_disconnect_poll=self.config.min_disconnect_poll,
	            max_disconnect_poll=self.config.max_disconnect_poll,
	            wait=self.config.wait,
	            read_only=self.config.read_only,
	            read_only_fallback=self.config.read_only_fallback,
	            username=self.config.username,
	            password=self.config.password,
	            realm=self.config.realm)

here BaseConfig has that bit of magic that has self.config.

I guess I need to know how to instantiate this class.  Any ideas?

David P. Mika


More information about the Zope mailing list