[spyne] Controlling namespace declaration

Burak Arslan burak.arslan at arskom.com.tr
Tue Jun 3 16:27:37 UTC 2014


context: 
https://mailman-mail5.webfaction.com/pipermail/lxml/2014-June/007190.html

On 03/06/14 18:55, Joseph L. Casale wrote:
>> Yes but I also tried a couple of things and couldn't find a way to trick
>> lxml to add a redundant xmlns declaration. I can't think of any other
>> way to make this work.
>>
>> For the record, it's possible to set the bogus attribute on
>> ctx.out_document in a method_return_document event and performing the
>> replace operation on ctx.out_string in a method_return_string event.
>>
>> http://spyne.io/docs/2.10/reference/service.html#spyne.service.ServiceBase
>> http://spyne.io/docs/2.10/reference/application.html#spyne.application.Application
> I ended up utilizing this for the time being and it appears to work. I set a pseudo attr
> in the model then renamed it after. However for the sake of clarity, how does one for
> example set a global namespace in the Application instance and expose services whose
> request and response objects begin a new ns?

Good idea, but I never tried this before. Two options:

1) By defining _body_style='bare' and defining custom request and 
response objects.
2) Setting _in_message_name = '{some_ns}some_name'

Could you try these and report back? Do they actually work? Does it 
break method dispatch?

Best,
Burak



More information about the people mailing list