[Checkins] SVN: zc.zope3recipes/trunk/ add "location" output value for the zopeconf recipe

Fred Drake fdrake at gmail.com
Wed Feb 8 03:29:22 UTC 2012


Log message for revision 124330:
  add "location" output value for the zopeconf recipe

Changed:
  U   zc.zope3recipes/trunk/README.txt
  U   zc.zope3recipes/trunk/zc/zope3recipes/README.txt
  U   zc.zope3recipes/trunk/zc/zope3recipes/recipes.py

-=-
Modified: zc.zope3recipes/trunk/README.txt
===================================================================
--- zc.zope3recipes/trunk/README.txt	2012-02-07 19:41:01 UTC (rev 124329)
+++ zc.zope3recipes/trunk/README.txt	2012-02-08 03:29:19 UTC (rev 124330)
@@ -21,6 +21,14 @@
 ********
 
 ===================
+0.17.0 (2012/02/07)
+===================
+
+- Added "location" value as output of the zopeconf recipe to make it
+  easier to use in place of ``zc.recipe.deployment:configuration``.
+
+
+===================
 0.16.0 (2012/01/15)
 ===================
 

Modified: zc.zope3recipes/trunk/zc/zope3recipes/README.txt
===================================================================
--- zc.zope3recipes/trunk/zc/zope3recipes/README.txt	2012-02-07 19:41:01 UTC (rev 124329)
+++ zc.zope3recipes/trunk/zc/zope3recipes/README.txt	2012-02-08 03:29:19 UTC (rev 124330)
@@ -2651,8 +2651,59 @@
       </logfile>
     </eventlog>
 
+The location of the file is made available as the "location" setting.
+This parallels the zc.recipe.deployment:configuration recipe, making
+this a possible replacement for that recipe where appropriate.
 
+    >>> write('buildout.cfg',
+    ... '''
+    ... [buildout]
+    ... develop = demo1
+    ... parts = another.conf
+    ...
+    ... [myapp]
+    ... recipe = zc.zope3recipes:application
+    ... site.zcml = <include package="demo1" />
+    ... eggs = demo1
+    ...
+    ... [some.conf]
+    ... recipe = zc.zope3recipes:zopeconf
+    ... application = myapp
+    ... text =
+    ...     <zodb>
+    ...       <zeoclient>
+    ...         server 127.0.0.1:8001
+    ...       </zeoclient>
+    ...     </zodb>
+    ...
+    ... [another.conf]
+    ... recipe = zc.zope3recipes:zopeconf
+    ... application = myapp
+    ... text =
+    ...     ${some.conf:text}
+    ...     <product-config reference>
+    ...       config ${some.conf:location}
+    ...     </product-config>
+    ...
+    ... ''' % globals())
 
+    >>> print system(join('bin', 'buildout')),
+    Develop: '/tmp/tmp2eRRw1buildoutSetUp/_TEST_/sample-buildout/demo1'
+    Uninstalling some.conf.
+    Updating myapp.
+    Installing some.conf.
+    Installing another.conf.
+
+    >>> cat('parts', 'another.conf')
+    site-definition /sample-buildout/parts/myapp/site.zcml
+    ...
+    <product-config reference>
+      config /sample-buildout/parts/some.conf
+    </product-config>
+    ...
+
+
+
 Offline recipe
 ==============
 
@@ -2724,6 +2775,7 @@
     >>> print system(join('bin', 'buildout')),
     Develop: '/sample-buildout/demo1'
     Develop: '/sample-buildout/demo2'
+    Uninstalling another.conf.
     Uninstalling some.conf.
     Uninstalling myapp.
     Installing myapp.

Modified: zc.zope3recipes/trunk/zc/zope3recipes/recipes.py
===================================================================
--- zc.zope3recipes/trunk/zc/zope3recipes/recipes.py	2012-02-07 19:41:01 UTC (rev 124329)
+++ zc.zope3recipes/trunk/zc/zope3recipes/recipes.py	2012-02-08 03:29:19 UTC (rev 124330)
@@ -614,9 +614,14 @@
         super(ZopeConf, self).__init__(buildout, name, options)
         if self.deployment:
             options['run-directory'] = self.deployment['run-directory']
+            zope_conf_path = os.path.join(
+                self.deployment['etc-directory'], self.name)
         else:
-            options['run-directory'] = os.path.join(
+            directory = os.path.join(
                 buildout['buildout']['parts-directory'])
+            options['run-directory'] = directory
+            zope_conf_path = os.path.join(directory, self.name)
+        options["location"] = zope_conf_path
 
     def install(self):
         options = self.options
@@ -646,11 +651,7 @@
         else:
             access_log_path = os.path.join(run_directory, access_log_name)
 
-        if self.deployment:
-            zope_conf_path = os.path.join(
-                self.deployment['etc-directory'], self.name)
-        else:
-            zope_conf_path = os.path.join(run_directory, self.name)
+        zope_conf_path = options["location"]
 
         if 'site-definition' not in zope_conf:
             app_loc = options["application-location"]



More information about the checkins mailing list