X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FNodeTypes.py;h=00d4bf71a44234eb23b12777030b197608caebc8;hb=HEAD;hp=e3db78185ab9b1e262fdc60dba249b0a5a3ba0c4;hpb=9765fce9ee4b154e25dbb1450377849401df2668;p=plcapi.git diff --git a/PLC/NodeTypes.py b/PLC/NodeTypes.py index e3db781..00d4bf7 100644 --- a/PLC/NodeTypes.py +++ b/PLC/NodeTypes.py @@ -1,7 +1,6 @@ # # Functions for interacting with the node_types table in the database # -# $Id$ # from PLC.Faults import * @@ -22,16 +21,16 @@ class NodeType(Row): } def validate_node_type(self, name): - # Make sure name is not blank + # Make sure name is not blank if not len(name): raise PLCInvalidArgument, "Node type must be specified" - - # Make sure node type does not alredy exist - conflicts = NodeTypes(self.api, [name]) + + # Make sure node type does not alredy exist + conflicts = NodeTypes(self.api, [name]) if conflicts: raise PLCInvalidArgument, "Node type name already in use" - return name + return name class NodeTypes(Table): """ @@ -43,8 +42,8 @@ class NodeTypes(Table): sql = "SELECT %s FROM node_types" % \ ", ".join(NodeType.fields) - + if node_types: - sql += " WHERE node_type IN (%s)" % ", ".join(map(api.db.quote, node_types)) + sql += " WHERE node_type IN (%s)" % ", ".join( [ api.db.quote (t) for t in node_types ] ) self.selectall(sql)