[Zope-Checkins] CVS: Zope/lib/python/Controller - schemaclasses.py:1.1.2.4
Chris McDonough
chrism@zope.com
Tue, 26 Nov 2002 18:42:15 -0500
Update of /cvs-repository/Zope/lib/python/Controller
In directory cvs.zope.org:/tmp/cvs-serv30074
Modified Files:
Tag: chrism-install-branch
schemaclasses.py
Log Message:
Exorcise __getattr__ access to configuration objects.
=== Zope/lib/python/Controller/schemaclasses.py 1.1.2.3 => 1.1.2.4 ===
--- Zope/lib/python/Controller/schemaclasses.py:1.1.2.3 Mon Nov 25 14:20:48 2002
+++ Zope/lib/python/Controller/schemaclasses.py Tue Nov 26 18:42:15 2002
@@ -176,7 +176,7 @@
class zope_home(_directory, ConfigKey):
def default(self):
config = self.getContext().getConfig()
- sh = config['software_home']
+ sh = config.get('software_home')
dn = os.path.dirname
zh = dn(dn(sh))
return zh
@@ -188,7 +188,7 @@
class instance_home(_directory, ConfigKey):
def default(self):
config = self.getContext().getConfig()
- return config['zope_home']
+ return config.get('zope_home')
def handle(self, value):
setenv('INSTANCE_HOME', value)
@@ -197,7 +197,7 @@
class client_home(_directory, ConfigKey):
def default(self):
config = self.getContext().getConfig()
- ih = config['instance_home']
+ ih = config.get('instance_home')
ih = os.path.join(ih, 'var')
return ih
@@ -299,7 +299,7 @@
class pid_filename(_dirname, ConfigKey):
def default(self):
config = self.getContext().getConfig()
- ch = config['client_home']
+ ch = config.get('client_home')
return os.path.join(ch, 'Z2.pid')
def handle(self, value):
@@ -308,7 +308,7 @@
class lock_filename(_dirname, ConfigKey):
def default(self):
config = self.getContext().getConfig()
- ch = config['client_home']
+ ch = config.get('client_home')
return os.path.join(ch, 'Z2.lock')
def handle(self, value):
@@ -319,7 +319,7 @@
return LoggerWrapper(self.name, level, handlerfactories)
def default(self):
- filepath = self.getContext().getConfig()['client_home']
+ filepath = self.getContext().getConfig().get('client_home')
filename = os.path.join(filepath, '%s.log' % self.name)
callback = None
if self.name == 'event':
@@ -505,7 +505,7 @@
class server(ConfigSection):
def get_dns_resolver(self):
- if not self.getContext().getConfig()['dns_ip_address']:
+ if not self.getContext().getConfig().get('dns_ip_address'):
return None
global _resolver
if not _resolver:
@@ -518,12 +518,12 @@
return
config = self.getContext().getConfig()
self._resolver = self.get_dns_resolver()
- self._read_only = config['zserver_read_only_mode']
- self._default_ip = config['ip_address'] or ''
+ self._read_only = config.get('zserver_read_only_mode')
+ self._default_ip = config.get('ip_address') or ''
self._pw = emergency_user_pw
- self._force = config['force_http_connection_close']
- self._module = config['module']
- self._env = config['cgi_environment_variable']
+ self._force = config.get('force_http_connection_close')
+ self._module = config.get('module')
+ self._env = config.get('cgi_environment_variable')
self._logger = AccessLogger
def getValue(self):
@@ -582,7 +582,7 @@
def default_http_server(self):
config = self.getContext().getConfig()
- return self.handle_http_server([[config['ip_address'], 8080]])
+ return self.handle_http_server([[config.get('ip_address'), 8080]])
def handle_webdav_source_server(self, ports):
for addr, port in ports:
@@ -612,7 +612,7 @@
def default_ftp_server(self):
config = self.getContext().getConfig()
- return self.handle_ftp_server([[config['ip_address'], 8021]])
+ return self.handle_ftp_server([[config.get('ip_address'), 8021]])
def default_webdav_source_server(self):
return []
@@ -684,7 +684,7 @@
class port(ConfigMultiKey):
def nodefault(self):
- a = self.getContext().getConfig()['ip_address']
+ a = self.getContext().getConfig().get('ip_address')
if self.parent.name == 'http':
value = (a, 8080)
if self.parent.name == 'webdav_source':
@@ -706,7 +706,7 @@
return 'Invalid port %s' % port
def handle(self, port):
- addr = self.getContext().getConfig()['ip_address']
+ addr = self.getContext().getConfig().get('ip_address')
return get_port(addr, port)
def multihandle(self, l):
@@ -868,7 +868,7 @@
prototype_class = _database
def default(self):
- ch = self.getContext().getConfig()['client_home']
+ ch = self.getContext().getConfig().get('client_home')
fn = os.path.join(ch, 'Data.fs')
storagefactory = Factory('ZODB.FileStorage.FileStorage',
None, *[], **{'file_name':fn})