[Freeipa-devel] [PATCH] another attempt at argument handling
Kevin McCarthy
kmccarth at redhat.com
Wed Aug 22 20:28:59 UTC 2007
Rob Crittenden wrote:
> This patch takes a different tact on argument handling. It fixes things up
> before even sending them across the XML-RPC connection. rpcclient.py now
> makes sure that all arguments are sent and if any are None, replaces them
> with the text __NONE__.
First comment is that this patch and the exception patch are going to
have some nasty merge errors. :-/ If people think the exception
approach is acceptable, it would be nice to get it pushed before it
becomes a big issue.
Other comment is in:
> - ret = func(*params,**opts)
> +
> + args = list(params)
> + arglen = len(args)
> + for i in range(len(args)):
> + if args[i] == '__NONE__':
> + args[i] = None
> +
> + if arglen == 1:
> + ret = func(args[0], opts)
> + elif arglen == 2:
> + ret = func(args[0], args[1], opts)
> + elif arglen == 3:
> + ret = func(args[0], args[1], args[2], opts)
> + elif arglen == 4:
> + ret = func(args[0], args[1], args[2], args[3], opts)
> + elif arglen == 5:
> + ret = func(args[0], args[1], args[2], args[3], args[4], opts)
> + else:
> + raise Fault(9, "Need more arguments to pass to %s" % method)
>
> return ret
Now that we are requiring all parameters, could this just be simplified
to:
ret = func(*args, **opts)
-Kevin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 2228 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20070822/0ab227b4/attachment.bin>
More information about the Freeipa-devel
mailing list