git://git.onelab.eu
/
plcapi.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
patch for php-5.3 (the one in f12)
[plcapi.git]
/
php
/
methods.py
diff --git
a/php/methods.py
b/php/methods.py
index
5b66594
..
621cc91
100755
(executable)
--- a/
php/methods.py
+++ b/
php/methods.py
@@
-5,7
+5,8
@@
# Mark Huang <mlhuang@cs.princeton.edu>
# Copyright (C) 2005 The Trustess of Princeton University
#
# Mark Huang <mlhuang@cs.princeton.edu>
# Copyright (C) 2005 The Trustess of Princeton University
#
-# $Id: methods.py,v 1.2 2006/11/10 06:32:26 mlhuang Exp $
+# $Id$
+# $URL$
#
import os, sys
#
import os, sys
@@
-15,6
+16,12
@@
from PLC.API import PLCAPI
from PLC.Method import *
from PLC.Auth import Auth
from PLC.Method import *
from PLC.Auth import Auth
+try:
+ set
+except NameError:
+ from sets import Set
+ set = Set
+
def php_cast(value):
"""
Casts Python values to PHP values.
def php_cast(value):
"""
Casts Python values to PHP values.
@@
-37,8
+44,8
@@
def php_cast(value):
# Class functions
api = PLCAPI(None)
# Class functions
api = PLCAPI(None)
-api.methods.sort()
-for method in api.methods:
+api.
all_
methods.sort()
+for method in api.
all_
methods:
# Skip system. methods
if "system." in method:
continue
# Skip system. methods
if "system." in method:
continue
@@
-81,6
+88,7
@@
for method in api.methods:
print "{"
# API function arguments
print "{"
# API function arguments
+ i = 0
for name, expected, default in parameters:
# Automatically added auth structures
if isinstance(expected, Auth) or \
for name, expected, default in parameters:
# Automatically added auth structures
if isinstance(expected, Auth) or \
@@
-89,7
+97,12
@@
for method in api.methods:
print " $args[] = $this->auth;"
continue
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
# Call API function
print " return $this->call('%s', $args);" % method