2
Call an arbitrary model's method.
13
class Call(client.Client):
15
Call an arbitrary model's method.
18
> oe call res.users.read '[1, 3]' '[]' -u 1 -p admin
20
# TODO The above docstring is completely borked in the
25
def __init__(self, subparsers=None):
26
super(Call, self).__init__(subparsers)
27
self.parser.add_argument('call', metavar='MODEL.METHOD',
28
help='the model and the method to call, using the '
29
'<model>.<method> format.')
30
self.parser.add_argument('args', metavar='ARGUMENT',
32
help='the argument for the method call, must be '
33
'`ast.literal_eval` compatible. Can be repeated.')
37
model, method = self.args.call.rsplit('.', 1)
39
print "Invalid syntax `%s` must have the form <model>.<method>."
41
args = tuple(map(ast.literal_eval, self.args.args)) if self.args.args else ()
42
x = self.execute(model, method, *args)
43
pprint.pprint(x, indent=4)