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):
except KeyError:
pass
def getNodeList(self, filter = None):
if filter is None:
def getNodeList(self, node_filter=None):
if node_filter is None:
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):
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):
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):
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):
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