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
rough cleanup of the slicemanager business
[sfa.git]
/
sfa
/
storage
/
parameter.py
diff --git
a/sfa/storage/parameter.py
b/sfa/storage/parameter.py
index
e520bfc
..
1545cac
100644
(file)
--- a/
sfa/storage/parameter.py
+++ b/
sfa/storage/parameter.py
@@
-5,9
+5,12
@@
# Copyright (C) 2006 The Trustees of Princeton University
#
# Copyright (C) 2006 The Trustees of Princeton University
#
-from types import NoneType, IntType, LongType, FloatType,
StringTypes,
DictType, TupleType, ListType
+from types import NoneType, IntType, LongType, FloatType, DictType, TupleType, ListType
from sfa.util.faults import SfaAPIError
from sfa.util.faults import SfaAPIError
+from sfa.util.py23 import StringType
+
+
class Parameter:
"""
Typed value wrapper. Use in accepts and returns to document method
class Parameter:
"""
Typed value wrapper. Use in accepts and returns to document method
@@
-15,11
+18,11
@@
class Parameter:
sub-parameters (i.e., dict fields).
"""
sub-parameters (i.e., dict fields).
"""
- def __init__(self, type, doc
=
"",
- min
= None, max =
None,
- optional
=
None,
- ro
=
False,
- nullok
=
False):
+ def __init__(self, type, doc
=
"",
+ min
=None, max=
None,
+ optional
=
None,
+ ro
=
False,
+ nullok
=
False):
# Basic type of the parameter. Must be a builtin type
# that can be marshalled by XML-RPC.
self.type = type
# Basic type of the parameter. Must be a builtin type
# that can be marshalled by XML-RPC.
self.type = type
@@
-49,6
+52,7
@@
class Parameter:
def __repr__(self):
return repr(self.type)
def __repr__(self):
return repr(self.type)
+
class Mixed(tuple):
"""
A list (technically, a tuple) of types. Use in accepts and returns
class Mixed(tuple):
"""
A list (technically, a tuple) of types. Use in accepts and returns
@@
-73,6
+77,7
@@
def python_type(arg):
else:
return type(arg)
else:
return type(arg)
+
def xmlrpc_type(arg):
"""
Returns the XML-RPC type of the specified argument, which may be a
def xmlrpc_type(arg):
"""
Returns the XML-RPC type of the specified argument, which may be a
@@
-89,7
+94,7
@@
def xmlrpc_type(arg):
return "boolean"
elif arg_type == FloatType:
return "double"
return "boolean"
elif arg_type == FloatType:
return "double"
- elif
arg_type in StringTypes
:
+ elif
issubclass(arg_type, StringType)
:
return "string"
elif arg_type == ListType or arg_type == TupleType:
return "array"
return "string"
elif arg_type == ListType or arg_type == TupleType:
return "array"
@@
-100,4
+105,4
@@
def xmlrpc_type(arg):
# documentation purposes.
return "mixed"
else:
# documentation purposes.
return "mixed"
else:
- raise SfaAPIError
, "XML-RPC cannot marshal %s objects" % arg_type
+ raise SfaAPIError
("XML-RPC cannot marshal %s objects" % arg_type)