[spyne] defining a service without expecting namespace in every tag
daniele at elkos.it
Tue Aug 11 14:24:54 UTC 2015
On 11 August 2015 at 15:29, Burak Arslan <burak.arslan at arskom.com.tr> wrote:
> On 08/11/15 15:28, Daniele Bortoluzzi wrote:
> > I saw that _body_style='bare' could be the solution.
Burak, I found the source of the argument number problem.
Following the examples/user_manager/server_sqlalchemy.py. I was overriding
def call_wrapper(self, ctx):
which, in turn, calls the ServiceBase.call_wrapper():
def call_wrapper(cls, ctx):
if ctx.function is not None:
return ctx.function(ctx, *ctx.in_object)
unpacking (star operator) the input object means that the ctx.function will
receive the object attributes instead of the "container".
With _body_style='bare' you must have only one input argument so the
wrapper should not unpack the in_object.
Removing the overridden call_wrapper() from my code does the job, because
the "unpacking problem" is correctly managed in the original
if ctx.descriptor.body_style is BODY_STYLE_BARE:
ctx.in_object = [ctx.in_object]
elif ctx.descriptor.body_style is BODY_STYLE_EMPTY:
ctx.in_object = 
According to the Spyne manual ("How Exactly is User Code Wrapped?")
ServiceBase.call_wrapper() is called *after* Application.call_wrapper(), so
when you override this function you must be sure that there are no
unpacking issues, right?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the people