[Zope-Checkins] CVS: Zope/lib/python/Startup - datatypes.py:1.3.2.1
Fred L. Drake, Jr.
fred@zope.com
Fri, 3 Jan 2003 11:01:41 -0500
Update of /cvs-repository/Zope/lib/python/Startup
In directory cvs.zope.org:/tmp/cvs-serv4645
Modified Files:
Tag: chrism-install-branch
datatypes.py
Log Message:
- clean up syntax usage that can be replaced with simpler constructs
- make_dict(): remove unused function
=== Zope/lib/python/Startup/datatypes.py 1.3 => 1.3.2.1 ===
--- Zope/lib/python/Startup/datatypes.py:1.3 Fri Jan 3 00:46:18 2003
+++ Zope/lib/python/Startup/datatypes.py Fri Jan 3 11:01:39 2003
@@ -50,15 +50,13 @@
dateformat = section.dateformat
level = section.level
- formatter = Factory('logging.Formatter', None,
- *[format, dateformat], **{})
+ formatter = Factory('logging.Formatter', None, format, dateformat)
def callback(inst, formatter=formatter, level=level):
inst.setFormatter(formatter())
inst.setLevel(level)
- return Factory('zLOG.LogHandlers.FileHandler', callback,
- *[file], **{})
+ return Factory('zLOG.LogHandlers.FileHandler', callback, file)
def syslog_facility(value):
d = {
@@ -104,8 +102,7 @@
raise ValueError, ('One of "socket" or "host" must be '
'specified in a syslog_handler section')
- formatter = Factory('logging.Formatter', None,
- *[format, dateformat], **{})
+ formatter = Factory('logging.Formatter', None, format, dateformat)
def callback(inst, formatter=formatter, level=level):
inst.setFormatter(formatter())
@@ -113,10 +110,9 @@
klass = 'zLOG.LogHandlers.SysLogHandler'
if socket:
- handler = Factory(klass, callback, *[socket, facility], **{})
+ handler = Factory(klass, callback, socket, facility)
else:
- handler = Factory(klass, callback, *[(host, port), facility],
- **{})
+ handler = Factory(klass, callback, (host, port), facility)
return handler
@@ -126,15 +122,13 @@
dateformat = section.dateformat
level = section.level
- formatter = Factory('logging.Formatter', None,
- *[format, dateformat], **{})
+ formatter = Factory('logging.Formatter', None, format, dateformat)
def callback(inst, formatter=formatter, level=level):
inst.setFormatter(formatter())
inst.setLevel(level)
- return Factory('zLOG.LogHandlers.NTEventLogHandler', callback, *[appname],
- **{})
+ return Factory('zLOG.LogHandlers.NTEventLogHandler', callback, appname)
def http_handler_url(value):
import urlparse
@@ -168,15 +162,13 @@
dateformat = section.dateformat
level = section.level
- formatter = Factory('logging.Formatter', None,
- *[format, dateformat], **{})
+ formatter = Factory('logging.Formatter', None, format, dateformat)
def callback(inst, formatter=formatter, level=level):
inst.setFormatter(formatter())
inst.setLevel(level)
- return Factory('zLOG.LogHandlers.HTTPHandler', callback,
- *[host, url, method], **{})
+ return Factory('zLOG.LogHandlers.HTTPHandler', callback, host, url, method)
def smtp_handler(section):
fromaddr = section.fromaddr
@@ -191,15 +183,14 @@
mailhost = host
else:
mailhost = host, port
- formatter = Factory('logging.Formatter', None,
- *[format, dateformat], **{})
+ formatter = Factory('logging.Formatter', None, format, dateformat)
def callback(inst, formatter=formatter, level=level):
inst.setFormatter(formatter())
inst.setLevel(level)
return Factory('zLOG.LogHandlers.SMTPHandler', callback,
- *[mailhost, fromaddr, toaddrs, subject], **{})
+ mailhost, fromaddr, toaddrs, subject)
def null_handler(section):
return Factory('zLOG.LogHandlers.NullHandler', None)
@@ -237,15 +228,14 @@
raise ValueError, 'Must name one storage in a database section'
klass = section.db_class
mounts = section.mount_points
- kwargs = {
- 'pool_size':section.pool_size,
- 'cache_size':section.cache_size,
- 'cache_deactivate_after':section.cache_deactivate_after,
- 'version_pool_size':section.version_pool_size,
- 'version_cache_size':section.version_cache_size,
- 'version_cache_deactivate_after':section.version_cache_deactivate_after,
- }
- dbfactory = Factory(klass, None, *[], **kwargs)
+ dbfactory = Factory(
+ klass, None,
+ pool_size=section.pool_size,
+ cache_size=section.cache_size,
+ cache_deactivate_after=section.cache_deactivate_after,
+ version_pool_size=section.version_pool_size,
+ version_cache_size=section.version_cache_size,
+ version_cache_deactivate_after=section.version_cache_deactivate_after)
storagefactory = section.storages[0]
return mounts, DBWrapper(dbfactory, storagefactory)
@@ -257,11 +247,11 @@
'stop':section.stop,
'quota':section.quota,
}
- return Factory('ZODB.FileStorage.FileStorage', None, *[file_name], **kw)
+ return Factory('ZODB.FileStorage.FileStorage', None, file_name, **kw)
def mappingstorage(section):
name = section.name
- return Factory('ZODB.MappingStorage.MappingStorage', None, *[name], **{})
+ return Factory('ZODB.MappingStorage.MappingStorage', None, name)
def clientstorage(section):
addr = section.addr
@@ -278,7 +268,7 @@
'read_only':section.read_only,
'read_only_fallback':section.read_only_fallback,
}
- return Factory('ZEO.ClientStorage.ClientStorage', None, *[addr], **kw)
+ return Factory('ZEO.ClientStorage.ClientStorage', None, addr, **kw)
_marker = []
@@ -333,6 +323,3 @@
self.dbfactory.setArgs(args, kw)
self.resolved = self.dbfactory()
return self.resolved
-
-def make_dict(**kw):
- return kw