Commit 7b3d9eea authored by Grégory Wisniewski's avatar Grégory Wisniewski

Don't shadow filter built-in function, and using it.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@957 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent ec30d8f5
...@@ -154,19 +154,22 @@ class NodeManager(object): ...@@ -154,19 +154,22 @@ class NodeManager(object):
except KeyError: except KeyError:
pass pass
def getNodeList(self, filter = None): def getNodeList(self, node_filter=None):
if filter is None: if node_filter is None:
return list(self.node_list) return list(self.node_list)
return [n for n in self.node_list if filter(n)] return filter(node_filter, self.node_list)
def getMasterNodeList(self): def getMasterNodeList(self):
return self.getNodeList(filter = lambda node: node.getNodeType() == MASTER_NODE_TYPE) node_filter = lambda node: node.getNodeType() == MASTER_NODE_TYPE
return self.getNodeList(node_filter=node_filter)
def getStorageNodeList(self): def getStorageNodeList(self):
return self.getNodeList(filter = lambda node: node.getNodeType() == STORAGE_NODE_TYPE) node_filter = lambda node: node.getNodeType() == STORAGE_NODE_TYPE
return self.getNodeList(node_filter=node_filter)
def getClientNodeList(self): def getClientNodeList(self):
return self.getNodeList(filter = lambda node: node.getNodeType() == CLIENT_NODE_TYPE) node_filter = lambda node: node.getNodeType() == CLIENT_NODE_TYPE
return self.getNodeList(node_filter=node_filter)
def getNodeByServer(self, server): def getNodeByServer(self, server):
return self.server_dict.get(server) return self.server_dict.get(server)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment