Package eoxserver :: Package core :: Module interfaces :: Class Arg
[hide private]
[frames] | no frames]

Class Arg

source code


This is the common base class for arguments of any kind; it can be used in interface declarations as well to represent an argument of arbitrary type. The constructor requires a ``name`` argument which denotes the argument name. The validation will check at class creation time if the method of an implementing class defines an argument of the given name, so you should always use valid Python variable names here (you can use arbitrary strings for return value declarations though). Furthermore, the constructor accepts a ``default`` keyword argument which defines a default value for the declared argument. The validation will check at class creation time if this default value is present in the implementing class and fail if it is not. Its methods are intended for internal use in runtime validation.
Instance Methods [hide private]
 
__init__(self, name, **kwargs)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
isOptional(self)
Returns ``True`` if the argument is optional, meaning that a default value has been defined for it, ``False`` otherwise.
source code
 
isValid(self, arg_value)
Returns ``True`` if ``arg_value`` is an acceptable value for the argument, ``False`` otherwise.
source code
 
isValidType(self, arg_value)
Returns ``True`` if the argument value ``arg_value`` has a valid type, ``False`` otherwise.
source code
 
getExpectedType(self)
Returns the expected type name; used in error messages only.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, name, **kwargs)
(Constructor)

source code 
x.__init__(...) initializes x; see help(type(x)) for signature
Overrides: object.__init__
(inherited documentation)

isValid(self, arg_value)

source code 
Returns ``True`` if ``arg_value`` is an acceptable value for the argument, ``False`` otherwise. Acceptable values are either the default value if it has been defined or values of the expected type.

isValidType(self, arg_value)

source code 
Returns ``True`` if the argument value ``arg_value`` has a valid type, ``False`` otherwise. This method is overridden by :class:`Arg` subclasses in order to check for individual types. The base class implementation always returns ``True`` meaning that all types of argument values are accepted.

getExpectedType(self)

source code 
Returns the expected type name; used in error messages only. This method is overridden by :class:`Arg` subclasses in order to customize error reporting. The base class implementation returns ``""``.