X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FNetworkTypes.py;h=eb34e7c9b1d96201c206fca390c05aead51533f9;hb=19d4a01ccf66af9e00914351b3eacd5fc880f988;hp=bab7af8baf77e34dce3eefb7eeac01a29a833414;hpb=619bbb1a7acb1fcbd68567529913b120678ecc1b;p=plcapi.git diff --git a/PLC/NetworkTypes.py b/PLC/NetworkTypes.py index bab7af8..eb34e7c 100644 --- a/PLC/NetworkTypes.py +++ b/PLC/NetworkTypes.py @@ -4,8 +4,6 @@ # Mark Huang # Copyright (C) 2006 The Trustees of Princeton University # -# $Id: NetworkTypes.py,v 1.3 2006/10/24 20:02:22 mlhuang Exp $ -# from PLC.Faults import * from PLC.Parameter import Parameter @@ -19,22 +17,22 @@ class NetworkType(Row): table_name = 'network_types' primary_key = 'type' - join_tables = ['nodenetworks'] + join_tables = ['interfaces'] fields = { 'type': Parameter(str, "Network type", max = 20), } 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]) + + # Make sure network type does not alredy exist + conflicts = NetworkTypes(self.api, [name]) if conflicts: 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)