cubicweb/utils.py
changeset 12308 cbbcfa69a0e7
parent 12306 c96dd92e480e
child 12309 48e763ad3b3f
--- a/cubicweb/utils.py	Tue Apr 24 15:21:18 2018 +0200
+++ b/cubicweb/utils.py	Wed Apr 25 15:29:25 2018 +0200
@@ -627,6 +627,12 @@
         with self._lock:
             return len(self._data)
 
+    def items(self):
+        """Get an iterator over the dictionary's items: (key, value) pairs"""
+        with self._lock:
+            for k, v in self._data.items():
+                yield k, v
+
     def get(self, k, default=None):
         """Get the value associated to the specified key
 
@@ -641,8 +647,8 @@
 
     def __iter__(self):
         with self._lock:
-            for k, v in self._data.items():
-                yield k, v
+            for k in iter(self._data):
+                yield k
 
     def __getitem__(self, k):
         with self._lock: