X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FNetworkTypes.py;h=fd3a30a583d86a37eebf03506c43cdf8cc034a18;hb=4facb0674ab3f9e2deac6e92717b71cbd05f3c10;hp=c4c8367b06b35d8cb450fa80d47527280b3edfd3;hpb=d910a6190fec258ddbf0e26d01539839ac3fdc76;p=plcapi.git diff --git a/PLC/NetworkTypes.py b/PLC/NetworkTypes.py index c4c8367..fd3a30a 100644 --- a/PLC/NetworkTypes.py +++ b/PLC/NetworkTypes.py @@ -4,8 +4,6 @@ # Mark Huang # Copyright (C) 2006 The Trustees of Princeton University # -# $Id$ -# from PLC.Faults import * from PLC.Parameter import Parameter @@ -25,16 +23,16 @@ class NetworkType(Row): } def validate_type(self, name): - # Make sure name is not blank + # Make sure name is not blank if not len(name): - raise PLCInvalidArgument, "Network type must be specified" - - # Make sure network type does not alredy exist - conflicts = NetworkTypes(self.api, [name]) + raise PLCInvalidArgument("Network type must be specified") + + # Make sure network type does not alredy exist + conflicts = NetworkTypes(self.api, [name]) if conflicts: - raise PLCInvalidArgument, "Network type name already in use" + raise PLCInvalidArgument("Network type name already in use") - return name + return name class NetworkTypes(Table): """ @@ -46,8 +44,8 @@ class NetworkTypes(Table): sql = "SELECT %s FROM network_types" % \ ", ".join(NetworkType.fields) - + if types: - sql += " WHERE type IN (%s)" % ", ".join(map(api.db.quote, types)) + sql += " WHERE type IN (%s)" % ", ".join( [ api.db.quote (t) for t in types ] ) self.selectall(sql)