# 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$
#
import os, sys
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.
print "{"
# API function arguments
+ i = 0
for name, expected, default in parameters:
# Automatically added auth structures
if isinstance(expected, Auth) or \
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