git://git.onelab.eu
/
plcapi.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix duplicate arg in helpers
[plcapi.git]
/
PLC
/
NetworkMethods.py
diff --git
a/PLC/NetworkMethods.py
b/PLC/NetworkMethods.py
index
41ccfab
..
4a68297
100644
(file)
--- a/
PLC/NetworkMethods.py
+++ b/
PLC/NetworkMethods.py
@@
-5,6
+5,7
@@
# Copyright (C) 2006 The Trustees of Princeton University
#
# $Id$
# Copyright (C) 2006 The Trustees of Princeton University
#
# $Id$
+# $URL$
#
from PLC.Faults import *
#
from PLC.Faults import *
@@
-19,22
+20,22
@@
class NetworkMethod(Row):
table_name = 'network_methods'
primary_key = 'method'
table_name = 'network_methods'
primary_key = 'method'
- join_tables = ['
nodenetwork
s']
+ join_tables = ['
interface
s']
fields = {
'method': Parameter(str, "Network method", max = 20),
}
def validate_method(self, name):
fields = {
'method': Parameter(str, "Network method", max = 20),
}
def validate_method(self, name):
- # Make sure name is not blank
+
# Make sure name is not blank
if not len(name):
raise PLCInvalidArgument, "Network method must be specified"
if not len(name):
raise PLCInvalidArgument, "Network method must be specified"
-
- # Make sure network method does not alredy exist
- conflicts = NetworkMethods(self.api, [name])
+
+
# Make sure network method does not alredy exist
+
conflicts = NetworkMethods(self.api, [name])
if conflicts:
raise PLCInvalidArgument, "Network method name already in use"
if conflicts:
raise PLCInvalidArgument, "Network method name already in use"
- return name
+
return name
class NetworkMethods(Table):
"""
class NetworkMethods(Table):
"""
@@
-46,7
+47,7
@@
class NetworkMethods(Table):
sql = "SELECT %s FROM network_methods" % \
", ".join(NetworkMethod.fields)
sql = "SELECT %s FROM network_methods" % \
", ".join(NetworkMethod.fields)
-
+
if methods:
sql += " WHERE method IN (%s)" % ", ".join(map(api.db.quote, methods))
if methods:
sql += " WHERE method IN (%s)" % ", ".join(map(api.db.quote, methods))