git://git.onelab.eu
/
sfa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
removed another bunch of references to geni
[sfa.git]
/
sfa
/
util
/
method.py
diff --git
a/sfa/util/method.py
b/sfa/util/method.py
index
f24dee5
..
1df1245
100644
(file)
--- a/
sfa/util/method.py
+++ b/
sfa/util/method.py
@@
-1,5
+1,5
@@
#
#
-# Base class for all
Geni
API functions
+# Base class for all
Sfa
API functions
#
#
#
#
@@
-22,7
+22,7
@@
from sfa.util.debug import profile, log
# we inherit object because we use new-style classes for legacy methods
class Method (object):
"""
# we inherit object because we use new-style classes for legacy methods
class Method (object):
"""
- Base class for all
GeniAPI functions. At a minimum, all Geni
API
+ Base class for all
SfaAPI functions. At a minimum, all Sfa
API
functions must define:
interfaces = [allowed interfaces]
functions must define:
interfaces = [allowed interfaces]
@@
-47,7
+47,7
@@
class Method (object):
def call(self, *args):
"""
def call(self, *args):
"""
- Method body for all
Geni
API functions. Must override.
+ Method body for all
Sfa
API functions. Must override.
"""
"""
@@
-66,7
+66,7
@@
class Method (object):
def __call__(self, *args, **kwds):
"""
def __call__(self, *args, **kwds):
"""
- Main entry point for all
Geni
API functions. Type checks
+ Main entry point for all
Sfa
API functions. Type checks
arguments, authenticates, and executes call().
"""
arguments, authenticates, and executes call().
"""
@@
-74,7
+74,7
@@
class Method (object):
start = time.time()
methodname = self.name
if not self.api.interface or self.api.interface not in self.interfaces:
start = time.time()
methodname = self.name
if not self.api.interface or self.api.interface not in self.interfaces:
- raise
Geni
InvalidAPIMethod, methodname, self.api.interface
+ raise
Sfa
InvalidAPIMethod, methodname, self.api.interface
# legacy code cannot be type-checked, due to the way Method.args() works
if not hasattr(self,"skip_typecheck"):
# legacy code cannot be type-checked, due to the way Method.args() works
if not hasattr(self,"skip_typecheck"):
@@
-82,7
+82,7
@@
class Method (object):
# Check that the right number of arguments were passed in
if len(args) < len(min_args) or len(args) > len(max_args):
# Check that the right number of arguments were passed in
if len(args) < len(min_args) or len(args) > len(max_args):
- raise
Geni
InvalidArgumentCount(len(args), len(min_args), len(max_args))
+ raise
Sfa
InvalidArgumentCount(len(args), len(min_args), len(max_args))
for name, value, expected in zip(max_args, args, self.accepts):
self.type_check(name, value, expected, args)
for name, value, expected in zip(max_args, args, self.accepts):
self.type_check(name, value, expected, args)
@@
-97,7
+97,7
@@
class Method (object):
return result
return result
- except
Geni
Fault, fault:
+ except
Sfa
Fault, fault:
caller = ""
caller = ""
@@
-218,7
+218,7
@@
class Method (object):
try:
self.type_check(name, value, item, args)
return
try:
self.type_check(name, value, item, args)
return
- except
Geni
InvalidArgument, fault:
+ except
Sfa
InvalidArgument, fault:
pass
raise fault
pass
raise fault
@@
-257,7
+257,7
@@
class Method (object):
pass
elif not isinstance(value, expected_type):
pass
elif not isinstance(value, expected_type):
- raise
Geni
InvalidArgument("expected %s, got %s" % \
+ raise
Sfa
InvalidArgument("expected %s, got %s" % \
(xmlrpc_type(expected_type),
xmlrpc_type(type(value))),
name)
(xmlrpc_type(expected_type),
xmlrpc_type(type(value))),
name)
@@
-266,20
+266,20
@@
class Method (object):
if expected_type in StringTypes:
if min is not None and \
len(value.encode(self.api.encoding)) < min:
if expected_type in StringTypes:
if min is not None and \
len(value.encode(self.api.encoding)) < min:
- raise
Geni
InvalidArgument, "%s must be at least %d bytes long" % (name, min)
+ raise
Sfa
InvalidArgument, "%s must be at least %d bytes long" % (name, min)
if max is not None and \
len(value.encode(self.api.encoding)) > max:
if max is not None and \
len(value.encode(self.api.encoding)) > max:
- raise
Geni
InvalidArgument, "%s must be at most %d bytes long" % (name, max)
+ raise
Sfa
InvalidArgument, "%s must be at most %d bytes long" % (name, max)
elif expected_type in (list, tuple, set):
if min is not None and len(value) < min:
elif expected_type in (list, tuple, set):
if min is not None and len(value) < min:
- raise
Geni
InvalidArgument, "%s must contain at least %d items" % (name, min)
+ raise
Sfa
InvalidArgument, "%s must contain at least %d items" % (name, min)
if max is not None and len(value) > max:
if max is not None and len(value) > max:
- raise
Geni
InvalidArgument, "%s must contain at most %d items" % (name, max)
+ raise
Sfa
InvalidArgument, "%s must contain at most %d items" % (name, max)
else:
if min is not None and value < min:
else:
if min is not None and value < min:
- raise
Geni
InvalidArgument, "%s must be > %s" % (name, str(min))
+ raise
Sfa
InvalidArgument, "%s must be > %s" % (name, str(min))
if max is not None and value > max:
if max is not None and value > max:
- raise
Geni
InvalidArgument, "%s must be < %s" % (name, str(max))
+ raise
Sfa
InvalidArgument, "%s must be < %s" % (name, str(max))
# If a list with particular types of items is expected
if isinstance(expected, (list, tuple, set)):
# If a list with particular types of items is expected
if isinstance(expected, (list, tuple, set)):
@@
-300,7
+300,7
@@
class Method (object):
if isinstance(subparam, Parameter) and \
subparam.optional is not None and \
not subparam.optional and key not in value.keys():
if isinstance(subparam, Parameter) and \
subparam.optional is not None and \
not subparam.optional and key not in value.keys():
- raise
Geni
InvalidArgument("'%s' not specified" % key, name)
+ raise
Sfa
InvalidArgument("'%s' not specified" % key, name)
#if auth is not None:
# auth.check(self, *args)
#if auth is not None:
# auth.check(self, *args)