[Neo-report] r1816 gregory - /trunk/neo/node.py

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Feb 22 12:42:08 CET 2010


Author: gregory
Date: Mon Feb 22 12:42:08 2010
New Revision: 1816

Log:
Add helper methods to filter nodes depending on connection state.

Modified:
    trunk/neo/node.py

Modified: trunk/neo/node.py
==============================================================================
--- trunk/neo/node.py [iso-8859-1] (original)
+++ trunk/neo/node.py [iso-8859-1] Mon Feb 22 12:42:08 2010
@@ -278,6 +278,24 @@
         if filter is None:
             return list(self._node_set)
         return filter(node_filter, self._node_set)
+
+    def getIdentifiedList(self, pool_set=None):
+        """
+            Returns a generator to iterate over identified nodes
+        """
+        # TODO: use an index
+        if pool_set is None:
+            return [x for x in self._node_set if x.isIdentified()]
+        else:
+            return [x for x in self._node_set if x.isIdentified() and
+            x.getUUID() in pool_set]
+
+    def getConnectedList(self):
+        """
+            Returns a generator to iterate over connected nodes
+        """
+        # TODO: use an index
+        return [x for x in self._node_set if x.isConnected()]
 
     def __getList(self, index_dict, key):
         return list(index_dict.setdefault(key, set()))





More information about the Neo-report mailing list