|
|
|
@ -94,7 +94,6 @@ def get_method_argparser(client, args):
|
|
|
|
|
def call_method(client, args):
|
|
|
|
|
method = args.method
|
|
|
|
|
method_parser, view = get_method_argparser(client, args)
|
|
|
|
|
|
|
|
|
|
param_object = _create_obj(client, method)
|
|
|
|
|
args = method_parser.parse_known_args()[0]
|
|
|
|
|
|
|
|
|
@ -104,6 +103,9 @@ def call_method(client, args):
|
|
|
|
|
param_object['CheckOnly'] = True
|
|
|
|
|
# print param_object
|
|
|
|
|
method_result = client.service[0][method](client.sid, param_object)
|
|
|
|
|
if not method_result:
|
|
|
|
|
print _('method is not available')
|
|
|
|
|
return None
|
|
|
|
|
if method_result.ReturnedMessage[0].type and \
|
|
|
|
|
method_result.ReturnedMessage[0].type != "pid":
|
|
|
|
|
for error in method_result.ReturnedMessage:
|
|
|
|
@ -130,6 +132,16 @@ def call_method(client, args):
|
|
|
|
|
|
|
|
|
|
param_object['CheckOnly'] = False
|
|
|
|
|
method_result = client.service[0][method](client.sid, param_object)
|
|
|
|
|
if not method_result:
|
|
|
|
|
print _('method is not available')
|
|
|
|
|
return None
|
|
|
|
|
if method_result.ReturnedMessage[0].type and \
|
|
|
|
|
method_result.ReturnedMessage[0].type != "pid":
|
|
|
|
|
for error in method_result.ReturnedMessage:
|
|
|
|
|
red = '\033[91m * \033[0m'
|
|
|
|
|
print red + error.message
|
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
return method_result
|
|
|
|
|
|
|
|
|
|
def _getattr(obj, attr):
|
|
|
|
@ -141,6 +153,8 @@ def collect_object(client, param_object, view, args):
|
|
|
|
|
if not Group.fields:
|
|
|
|
|
continue
|
|
|
|
|
for field in Group.fields.Field:
|
|
|
|
|
if field.uncompatible:
|
|
|
|
|
continue
|
|
|
|
|
if field.element in ['check', 'check_tristate'] or \
|
|
|
|
|
field.element == 'radio' and field.type == 'bool':
|
|
|
|
|
param_object[field.name] = _getattr(args, field.name)
|
|
|
|
|