class _command_init(object):
def __init__(self, arguments={}):
- self.arguments = arguments
+ if not hasattr(self, 'arguments'):
+ self.arguments = {}
+ self.arguments.update(arguments)
try:
- self.config = self.get_argument('config')
+ self.config = self['config'].value
+ #self.config = self.get_argument('config')
except KeyError:
pass
+ def __getitem__(self, argterm):
+ """
+ :param argterm: (str) the name/label of an argument in self.arguments
+
+ :returns: (Argument)
+
+ :raises KeyError: if argterm not in self.arguments of this object
+ """
+ return self.arguments[argterm]
+
+ def __setitem__(self, argterm, arg):
+ """Install an argument as argterm
+ If argterm points to another argument, the other argument is lost
+
+ :param argterm: (str)
+
+ :param arg: (Argument)
+ """
+ if not hasattr(self, 'arguments'):
+ self.arguments = {}
+ self.arguments[argterm] = arg
+
def get_argument(self, argterm):
+ """
+ :param argterm: (str) the name/label of an argument in self.arguments
+
+ :returns: the value of the arument object
+
+ :raises KeyError: if argterm not in self.arguments of this object
+ """
return self.arguments[argterm].value