[Checkins] SVN: zc.zookeeperrecipes/trunk/src/zc/zookeeperrecipes/ Fixed: default ZooKeeper connection string wasn't set as option and

Jim Fulton jim at zope.com
Mon Feb 13 21:57:30 UTC 2012


Log message for revision 124389:
  Fixed: default ZooKeeper connection string wasn't set as option and
         was thus not usable from other parts.
  

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

-=-
Modified: zc.zookeeperrecipes/trunk/src/zc/zookeeperrecipes/README.txt
===================================================================
--- zc.zookeeperrecipes/trunk/src/zc/zookeeperrecipes/README.txt	2012-02-13 12:49:12 UTC (rev 124388)
+++ zc.zookeeperrecipes/trunk/src/zc/zookeeperrecipes/README.txt	2012-02-13 21:57:28 UTC (rev 124389)
@@ -60,7 +60,8 @@
      'import-text': "\nx=1\ntype = 'foo'\n/a\n   /b\n/c\n",
      'location': '/testdirectory/parts/myproject',
      'path': '/myproject',
-     'recipe': 'zc.zookeeperrecipes:devtree'}
+     'recipe': 'zc.zookeeperrecipes:devtree',
+     'zookeeper': '127.0.0.1:2181'}
 
     >>> recipe.install()
     ()
@@ -175,7 +176,8 @@
      'import-text': '\n/a\n  /b\n/c\n',
      'location': '/testdirectory/parts/myproj',
      'path': '/myproj',
-     'recipe': 'zc.zookeeperrecipes:devtree'}
+     'recipe': 'zc.zookeeperrecipes:devtree',
+     'zookeeper': '127.0.0.1:2181'}
 
     >>> with mock.patch('os.getpid') as getpid:
     ...     getpid.return_value = 42
@@ -215,7 +217,8 @@
      'import-text': '\n/a\n  /b\n/c\n',
      'location': '/tmp/tmpZ3mohq/testdirectory/parts/myproj',
      'path': '/ztest/path',
-     'recipe': 'zc.zookeeperrecipes:devtree'}
+     'recipe': 'zc.zookeeperrecipes:devtree',
+     'zookeeper': '127.0.0.1:2181'}
 
     >>> with mock.patch('os.getpid') as getpid:
     ...     getpid.return_value = 42
@@ -260,7 +263,8 @@
      'import-file': 'tree.txt',
      'import-text': '\n/a\n  /b\n/c\n',
      'location': '/testdirectory/parts/myproj',
-     'recipe': 'zc.zookeeperrecipes:devtree'}
+     'recipe': 'zc.zookeeperrecipes:devtree',
+     'zookeeper': '127.0.0.1:2181'}
 
     >>> zk.print_tree() # doctest: +NORMALIZE_WHITESPACE +ELLIPSIS
     /my
@@ -397,6 +401,12 @@
 Change History
 ==============
 
+0.1.2 (2011-02-13)
+------------------
+
+Fixed: default ZooKeeper connection string wasn't set as option and
+       was thus not usable from other parts.
+
 0.1.1 (2011-02-09)
 ------------------
 

Modified: zc.zookeeperrecipes/trunk/src/zc/zookeeperrecipes/__init__.py
===================================================================
--- zc.zookeeperrecipes/trunk/src/zc/zookeeperrecipes/__init__.py	2012-02-13 12:49:12 UTC (rev 124388)
+++ zc.zookeeperrecipes/trunk/src/zc/zookeeperrecipes/__init__.py	2012-02-13 21:57:28 UTC (rev 124389)
@@ -31,6 +31,10 @@
 
     def __init__(self, buildout, name, options):
         self.name, self.options = name, options
+
+        if 'zookeeper' not in options:
+            options['zookeeper'] = '127.0.0.1:2181'
+
         if 'import-file' in options:
             options['import-text'] = open(os.path.join(
                 buildout['buildout']['directory'],
@@ -63,7 +67,7 @@
 
     def install(self):
         options = self.options
-        connection = options.get('zookeeper', '127.0.0.1:2181')
+        connection = options['zookeeper']
         zk = zc.zk.ZooKeeper(connection)
         location = options['location']
         path = options['effective-path']



More information about the checkins mailing list