arskom/rpclib — Issue #102: AttributeError when setting nillable for ComplexModel parameters
Author: tko
Created: 2011-10-20 09:48:00+00:00
State: open

```python
from rpclib.application import Application
from rpclib.decorator import srpc
from rpclib.interface.wsdl import Wsdl11
from rpclib.model.complex import ComplexModel
from rpclib.model.primitive import String
from rpclib.protocol.soap import Soap11
from rpclib.service import ServiceBase

class Model(ComplexModel):
val = String

class Service(ServiceBase):
@srpc(Model(nillable=False))
def method(model):
pass

app = Application([Service], 'com.example', interface=Wsdl11(),
in_protocol=Soap11(), out_protocol=Soap11())
```

Traceback (most recent call last):
File "testrpc.py", line 18, in
in_protocol=Soap11(), out_protocol=Soap11())
File "/opt/lib/python2.6/site-packages/rpclib/application.py", line 73, in __init__
self.interface.set_app(self)
File "/opt/lib/python2.6/site-packages/rpclib/interface/_base.py", line 55, in set_app
self.populate_interface()
File "/opt/lib/python2.6/site-packages/rpclib/interface/_base.py", line 188, in populate_interface
self.add(method.in_message)
File "/opt/lib/python2.6/site-packages/rpclib/interface/xml_schema/_base.py", line 87, in add
return handler(self, cls)
File "/opt/lib/python2.6/site-packages/rpclib/interface/xml_schema/model/complex.py", line 59, in complex_add
interface.add(v)
File "/opt/lib/python2.6/site-packages/rpclib/interface/xml_schema/_base.py", line 86, in add
handler = _add_handlers[cls]
File "/opt/lib/python2.6/site-packages/rpclib/util/cdict.py", line 42, in __getitem__
for b in cls.__bases__:
AttributeError: 'Model' object has no attribute '__bases__'

With primitive types like `@srpc(String(nillable=False))` it seems to work.