← Back to team overview

ladon-dev-team team mailing list archive

Re: [Question #241425]: duplicates of complex service types when serving as wsgiapp

 

Question #241425 on ladon changed:
https://answers.launchpad.net/ladon/+question/241425

Mads Find Madsen gave more information on the question:
Ok, a bit closer to solving the issue:
I put in some print statements to examine type_order in the soap11.py file in ladon to figure out what is happening when the wsdl is being generated.

So the types look like this:

{'attributes': [('name', <type 'str'>, {'type': <type 'str'>}), ('unit',
<type 'str'>, {'type': <type 'str'>}), ('value', <type 'str'>, {'type':
<type 'str'>})], 'parse_order': 0, 'name': 'Result', 'module':
'mo2server.dummyservices'}

 [<class 'mo2server.dummyservices.Result'>]

{'attributes': [('name', <type 'str'>, {'type': <type 'str'>}), ('unit',
<type 'str'>, {'type': <type 'str'>}), ('value', <type 'str'>, {'type':
<type 'str'>})], 'parse_order': 1, 'name': 'Result', 'module':
'dummyservices'}

[<class 'dummyservices.Result'>]

Exact duplicates of everything, identical except for the 'module'.
it looks like there are two instances of Result, because it has been imported twice. My (novice python) suggestion is that it happens once when the package is loaded initially, and once when and once when calling LadonWSGIApplication from inside the package. Hence the different relative names.

Still not sure what I should do to avoid loading the module twice - is there some way to keep python from loading a specific file in a package, so it will only be loaded when run by LadonWSGIApplication? (Actually I was naively thinking that it would be some sort of dark incantation keeping python from loading the same .py file twice... but goes to show how little I understand!).
Would it be better to try to modify the code so it simply checks not to write two types with the same name in the WSDL?

-- 
You received this question notification because you are a member of
Ladon Developer, which is an answer contact for ladon.