[Checkins] SVN: zc.z3monitor/trunk/ changed product-config to ``bind``, ``port`` still useable
Adam Groszer
agroszer at gmail.com
Sun Jan 24 09:24:42 EST 2010
Log message for revision 108437:
changed product-config to ``bind``, ``port`` still useable
Changed:
U zc.z3monitor/trunk/buildout.cfg
U zc.z3monitor/trunk/src/zc/z3monitor/CHANGES.txt
U zc.z3monitor/trunk/src/zc/z3monitor/README.txt
U zc.z3monitor/trunk/src/zc/z3monitor/__init__.py
-=-
Modified: zc.z3monitor/trunk/buildout.cfg
===================================================================
--- zc.z3monitor/trunk/buildout.cfg 2010-01-24 14:20:01 UTC (rev 108436)
+++ zc.z3monitor/trunk/buildout.cfg 2010-01-24 14:24:41 UTC (rev 108437)
@@ -1,5 +1,8 @@
[buildout]
develop = .
+ ../../zc.ngi/trunk
+ ../../zc.monitor/trunk
+
parts = instance test zodb storage interpreter
[zodb]
@@ -61,7 +64,7 @@
<grantAll role="zope.Manager" />
<unauthenticatedPrincipal
id="zope.anybody"
- title="Unauthenticated User"
+ title="Unauthenticated User"
/>
<principal
id="zope.manager"
Modified: zc.z3monitor/trunk/src/zc/z3monitor/CHANGES.txt
===================================================================
--- zc.z3monitor/trunk/src/zc/z3monitor/CHANGES.txt 2010-01-24 14:20:01 UTC (rev 108436)
+++ zc.z3monitor/trunk/src/zc/z3monitor/CHANGES.txt 2010-01-24 14:24:41 UTC (rev 108437)
@@ -8,7 +8,8 @@
Features
--------
-* New optional ``address`` product-config option to bind to a specific adapter
+* New ``bind`` product-config option to bind to a specific address/socket
+ Old ``port`` still useable.
0.7.0 (2008-09-14)
==================
Modified: zc.z3monitor/trunk/src/zc/z3monitor/README.txt
===================================================================
--- zc.z3monitor/trunk/src/zc/z3monitor/README.txt 2010-01-24 14:20:01 UTC (rev 108436)
+++ zc.z3monitor/trunk/src/zc/z3monitor/README.txt 2010-01-24 14:24:41 UTC (rev 108437)
@@ -18,20 +18,26 @@
The ZConfig setup is not demonstrated in this documentation, but the usage is
simple. In your ZConfig file, provide a "product-config" stanza for
zc.z3monitor that specifies the port on which the zc.monitor server should
-listen. For instance, this stanza will start a monitor server on port 8888::
+listen.
+For instance, this stanza will start a monitor server on port 8888::
+
<product-config zc.z3monitor>
- port 8888
+ bind 8888
</product-config>
-Optionally you can include an ``address`` parameter to bind to a specific
-adapter::
+To bind to a specific address::
<product-config zc.z3monitor>
- port 8888
- address 127.0.0.1
+ bind 127.0.0.1:8888
</product-config>
+To bind to a unix domain socket::
+
+ <product-config zc.z3monitor>
+ bind /var/socket
+ </product-config>
+
To include the default commands of zc.monitor and zc.z3monitor, simply include
the configure.zcml from this package::
Modified: zc.z3monitor/trunk/src/zc/z3monitor/__init__.py
===================================================================
--- zc.z3monitor/trunk/src/zc/z3monitor/__init__.py 2010-01-24 14:20:01 UTC (rev 108436)
+++ zc.z3monitor/trunk/src/zc/z3monitor/__init__.py 2010-01-24 14:24:41 UTC (rev 108437)
@@ -171,14 +171,33 @@
if db.getActivityMonitor() is None:
db.setActivityMonitor(ZODB.ActivityMonitor.ActivityMonitor())
- port = int(config['port'])
try:
- address = config['address']
- zc.monitor.start(port, address = address)
- except KeyError:
#being backwards compatible here and not passing address if not given
+ port = int(config['port'])
zc.monitor.start(port)
+ except KeyError:
+ #new style bind
+ try:
+ bind = config['bind']
+ bind = bind.strip()
+ m = re.match(r'^(?P<addr>\S+):(?P<port>\d+)$', bind)
+ if m:
+ #we have an address:port
+ zc.monitor.start((m.group('addr'), int(m.group('port'))))
+ return
+ m = re.match(r'^(?P<port>\d+)$', bind)
+ if m:
+ #we have a port
+ zc.monitor.start(int(m.group('port')))
+ return
+
+ #we'll consider everything else as a domain socket
+ zc.monitor.start(bind)
+ except KeyError:
+ #no bind config no server
+ pass
+
@zope.component.adapter(
zope.traversing.interfaces.IContainmentRoot,
zope.app.publication.interfaces.IBeforeTraverseEvent,
More information about the checkins
mailing list