[Checkins] SVN: zc.zk/trunk/src/zc/zk/ - Fixed: Property links were incomplete:

jim cvs-admin at zope.org
Fri Aug 31 19:19:26 UTC 2012


Log message for revision 127661:
  - Fixed: Property links were incomplete:
           Iteration and methods keys, values, and items weren't handled
           correctly.
  

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

-=-
Modified: zc.zk/trunk/src/zc/zk/README.txt
===================================================================
--- zc.zk/trunk/src/zc/zk/README.txt	2012-08-31 14:15:51 UTC (rev 127660)
+++ zc.zk/trunk/src/zc/zk/README.txt	2012-08-31 19:19:22 UTC (rev 127661)
@@ -1169,11 +1169,15 @@
 ==============
 
 
-0.9.2 (2012-08-10)
+0.9.2 (2012-??-??)
 ------------------
 
 - Fixed: The documentation for get_properties was missleading.
 
+- Fixed: Property links were incomplete:
+         Iteration and methods keys, values, and items weren't handled
+         correctly.
+
 0.9.2 (2012-08-08)
 ------------------
 

Modified: zc.zk/trunk/src/zc/zk/__init__.py
===================================================================
--- zc.zk/trunk/src/zc/zk/__init__.py	2012-08-31 14:15:51 UTC (rev 127660)
+++ zc.zk/trunk/src/zc/zk/__init__.py	2012-08-31 19:19:22 UTC (rev 127661)
@@ -812,6 +812,12 @@
                     (key + ' =>', self.data[key + ' =>'])
                     )
 
+    def __iter__(self):
+        for key in self.data:
+            if key.endswith(' =>'):
+                key = key[:-3]
+            yield key
+
     def __len__(self):
         return len(self.data)
 

Modified: zc.zk/trunk/src/zc/zk/tests.py
===================================================================
--- zc.zk/trunk/src/zc/zk/tests.py	2012-08-31 14:15:51 UTC (rev 127660)
+++ zc.zk/trunk/src/zc/zk/tests.py	2012-08-31 19:19:22 UTC (rev 127661)
@@ -1500,7 +1500,45 @@
     >>> zk.close()
     """
 
+def property_links_edge_cases():
+    """
 
+    >>> zk = zc.zk.ZooKeeper('zookeeper.example.com:2181')
+    >>> zk.import_tree('''
+    ... /app
+    ...   threads => ..
+    ...   color = 'red'
+    ...   database -> /databases/foo
+    ... ''', '/fooservice')
+    >>> zk.print_tree()
+    /fooservice
+      database = u'/databases/foomain'
+      favorite_color = u'red'
+      threads = 1
+      /app
+        color = u'red'
+        threads => = u'..'
+        database -> /databases/foo
+      /providers
+
+    >>> properties = zk.properties('/fooservice/app')
+    >>> sorted(properties)
+    [u'color', u'database ->', u'threads']
+
+    >>> sorted(properties.keys())
+    [u'color', u'database ->', u'threads']
+
+    >>> sorted(properties.values())
+    [1, u'/databases/foo', u'red']
+
+    >>> sorted(properties.items())
+    [(u'color', u'red'), (u'database ->', u'/databases/foo'), (u'threads', 1)]
+
+    >>> pprint(dict(properties))
+    {u'color': u'red', u'database ->': u'/databases/foo', u'threads': 1}
+    """
+
+
 event = threading.Event()
 def check_async(show=True, expected_status=0):
     event.clear()



More information about the checkins mailing list