Re: [Zope-dev] XMLRPC with varargs
But I was talking only about implementation of server side function and, I think, it is possible use python specialities without desagree XMLRPC cross language technology. In this case, only '*' arguments. If I make a call like Foo( 1, 2 ) The server side implementation could be def Foo( a, b ) or def Foo( *a ) I think that is a valid point. However I would enter a bug into the collector and add the patch there. Otherwise it will get lost in the traffic that is the mailing list and no action will happen. Thanks -- Andy McKay ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] XMLRPC with varargs
Dieter, Ok. But I was talking only about implementation of server side function and, I think, it is possible use python specialities without desagree XMLRPC cross language technology. In this case, only '*' arguments. If I make a call like Foo( 1, 2 ) The server side implementation could be def Foo( a, b ) or def Foo( *a ) I developed some kind of proxy function using '*' arguments and Acquisition. -- Marco Catunda On Tue, 2003-03-18 at 18:48, Dieter Maurer wrote: > Marco Catunda wrote at 2003-3-17 19:39 -0300: > > I have tried call a function via XMLRPC with * and ** args > > with no success! > > XMLRPC is a cross language technology. > > It does not support Python specialities such as "*" and "**" arguments. > > > Dieter > > ___ > Zope-Dev maillist - [EMAIL PROTECTED] > http://mail.zope.org/mailman/listinfo/zope-dev > ** No cross posts or HTML encoding! ** > (Related lists - > http://mail.zope.org/mailman/listinfo/zope-announce > http://mail.zope.org/mailman/listinfo/zope ) > > ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] XMLRPC with varargs
Marco Catunda wrote at 2003-3-17 19:39 -0300: > I have tried call a function via XMLRPC with * and ** args > with no success! XMLRPC is a cross language technology. It does not support Python specialities such as "*" and "**" arguments. Dieter ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] XMLRPC with varargs
Hello, Sorry, I made mistake on last patch... I am sending the correct one --- mapply.py 2003-03-17 20:11:23.0 -0300 +++ mapply.py.new 2003-03-17 20:11:16.0 -0300 @@ -13,6 +13,8 @@ """Provide an apply-like facility that works with any mapping object """ +import inspect + def default_call_object(object, args, context): result=apply(object,args) # Type s to step into published object. return result @@ -23,11 +25,15 @@ def default_handle_class(klass, context): if hasattr(klass,'__init__'): f=klass.__init__.im_func -c=f.func_code -names=c.co_varnames[1:c.co_argcount] -return klass, names, f.func_defaults +#c=f.func_code +#names=c.co_varnames[1:c.co_argcount] +spec=inpect.getargspec(f) +names=spec[0][1:] +defaults=spec[3] +vargs=spec[1:3] +return klass, names, defaults, vargs else: -return klass, (), () +return klass, (), (), [] def mapply(object, positional=(), keyword={}, debug=None, maybe=None, @@ -37,7 +43,7 @@ ): if hasattr(object,'__bases__'): -f, names, defaults = handle_class(object, context) +f, names, defaults, vargs = handle_class(object, context) else: f=object im=0 @@ -53,20 +59,25 @@ if im: f=f.im_func -c=f.func_code -defaults=f.func_defaults -names=c.co_varnames[1:c.co_argcount] +#c=f.func_code +#defaults=f.func_defaults +#names=c.co_varnames[1:c.co_argcount] +spec=inspect.getargspec(f) +names=spec[0][1:] +defaults=spec[3] +vargs=spec[1:3] else: defaults=f.func_defaults c=f.func_code names=c.co_varnames[:c.co_argcount] +vargs=None nargs=len(names) if positional: positional=list(positional) if bind and nargs and names[0]=='self': positional.insert(0, missing_name('self', context)) -if len(positional) > nargs: raise TypeError, 'too many arguments' +if (len(positional) > nargs) and not vargs: raise TypeError, 'too many arguments' args=positional else: if bind and nargs and names[0]=='self': ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )