From: Mark Huang Date: Wed, 29 Nov 2006 19:43:17 +0000 (+0000) Subject: - only add optional arguments if specified X-Git-Tag: pycurl-7_13_1~228 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=6eb2f5955364d5d9d9b1dfca5e04389c3234ec26;p=plcapi.git - only add optional arguments if specified --- diff --git a/php/methods.py b/php/methods.py index 5b66594d..27761a05 100755 --- a/php/methods.py +++ b/php/methods.py @@ -5,7 +5,7 @@ # Mark Huang # Copyright (C) 2005 The Trustess of Princeton University # -# $Id: methods.py,v 1.2 2006/11/10 06:32:26 mlhuang Exp $ +# $Id: methods.py,v 1.3 2006/11/21 20:00:53 mlhuang Exp $ # import os, sys @@ -81,6 +81,7 @@ for method in api.methods: print "{" # API function arguments + i = 0 for name, expected, default in parameters: # Automatically added auth structures if isinstance(expected, Auth) or \ @@ -89,7 +90,12 @@ for method in api.methods: print " $args[] = $this->auth;" continue - print " $args[] = $%s;" % name + print " ", + if name not in min_args: + print "if (func_num_args() > %d)" % i, + print "$args[] = $%s;" % name + + i += 1 # Call API function print " return $this->call('%s', $args);" % method