From 6eb2f5955364d5d9d9b1dfca5e04389c3234ec26 Mon Sep 17 00:00:00 2001 From: Mark Huang Date: Wed, 29 Nov 2006 19:43:17 +0000 Subject: [PATCH] - only add optional arguments if specified --- php/methods.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/php/methods.py b/php/methods.py index 5b66594..27761a0 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 -- 2.43.0