X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FNetworkTypes.py;h=7e9187c713d4ea54f594aee0a8de2309886a7fee;hb=9878a3da9568b100757b0313933441d2c7b1e7d2;hp=bab7af8baf77e34dce3eefb7eeac01a29a833414;hpb=619bbb1a7acb1fcbd68567529913b120678ecc1b;p=plcapi.git diff --git a/PLC/NetworkTypes.py b/PLC/NetworkTypes.py index bab7af8..7e9187c 100644 --- a/PLC/NetworkTypes.py +++ b/PLC/NetworkTypes.py @@ -4,7 +4,8 @@ # Mark Huang # Copyright (C) 2006 The Trustees of Princeton University # -# $Id: NetworkTypes.py,v 1.3 2006/10/24 20:02:22 mlhuang Exp $ +# $Id$ +# $URL$ # from PLC.Faults import * @@ -19,22 +20,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,7 +47,7 @@ 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))