[Checkins] SVN: zc.recipe.zeoinstance/trunk/ Added support for a specified port.

Jim Fulton jim at zope.com
Wed Jul 19 15:46:23 EDT 2006


Log message for revision 69210:
  Added support for a specified port.
  
  Added a generated zconfif option so that a zeoinstance part can be
  used as a database in a zope instance part.
  

Changed:
  U   zc.recipe.zeoinstance/trunk/README.txt
  U   zc.recipe.zeoinstance/trunk/src/zc/recipe/zeoinstance/__init__.py

-=-
Modified: zc.recipe.zeoinstance/trunk/README.txt
===================================================================
--- zc.recipe.zeoinstance/trunk/README.txt	2006-07-19 19:15:26 UTC (rev 69209)
+++ zc.recipe.zeoinstance/trunk/README.txt	2006-07-19 19:46:22 UTC (rev 69210)
@@ -1,8 +1,7 @@
 Recipe for creating a ZEO instance
 ======================================
 
-This recipe creates a Zope instance that has been extended by a
-collection of eggs.
+This recipe creates a basic ZEO instance.
 
 The recipe takes the following options:
 
@@ -18,10 +17,28 @@
    The name of a section defining a zconfig option that has a zodb
    section.
 
+port
+   The port to listen on. This defaults to 8100
       
+The recipe generates a zconfig option that can be used by parts
+needing a database configuration.
+
+
+
 To do
 -----
 
+- This probably only works with a zope3-internal ZEO installation,
+  because of the way we determine the location (and name?) of the
+  mkzeoinstance script.
+
 - Need tests
 
 - Support for more configuration options.
+
+- Instance generation using a recipe-internal template for zeo.conf,
+  rather than hacking the configuration file produced by
+  mkzeoinstance.
+
+
+  

Modified: zc.recipe.zeoinstance/trunk/src/zc/recipe/zeoinstance/__init__.py
===================================================================
--- zc.recipe.zeoinstance/trunk/src/zc/recipe/zeoinstance/__init__.py	2006-07-19 19:15:26 UTC (rev 69209)
+++ zc.recipe.zeoinstance/trunk/src/zc/recipe/zeoinstance/__init__.py	2006-07-19 19:46:22 UTC (rev 69210)
@@ -22,6 +22,8 @@
             )
         python = buildout['buildout']['python']
         options['executable'] = buildout[python]['executable']
+        options['port'] = options.get('port', '8100')
+        options['zconfig'] = zeoclient_tempalte % options['port']
 
     def _getdbconfig(self, buildout, options):
         dbconfig = buildout[options['database']]['zconfig']
@@ -56,7 +58,10 @@
         try:
             # Now, patch the zodb option in zeo.conf
             zeo_conf_path = os.path.join(location, 'etc', 'zeo.conf')
-            zeo_conf = open(zeo_conf_path).read()            
+            zeo_conf = open(zeo_conf_path).read()
+            zeo_conf = zeo_conf.replace('address 8100',
+                                        'address %s' % options['port'],
+                                        1)
             zeo_conf = (
                 zeo_conf[:zeo_conf.find('<filestorage 1>')]
                 +
@@ -73,3 +78,11 @@
             raise
         
         return location
+
+zeoclient_tempalte = """\
+<zodb>
+  <zeoclient>
+     server localhost:%s
+  </zeoclient>
+</zodb>
+"""



More information about the Checkins mailing list