return cls.__mro__ AttributeError: 'list' object has no attribute '__mro__'

Asked by Ales Klimsa on 2012-02-10

Hi Jakob,
when I defined this attribute from ladon complex type:
contacts = {
                'type' : [Contact],
                'nullable' : True,
                'doc' : "List of contacts"
                }

I got this error:
Traceback (most recent call last):
  File "/python3/lib/python3.2/site-packages/ladon-0.7.0-py3.2.egg/ladon/server/wsgi_application.py", line 296, in __call__
    self.import_services(self.service_list)
  File "/python3/lib/python3.2/site-packages/ladon-0.7.0-py3.2.egg/ladon/server/wsgi_application.py", line 252, in import_services
    __import__(service)
  File "/home/webhosting/ws.dev.savvy.cz/www/service/Project365APIWebServices.py", line 26, in <module>
    class Project365APIWebServices(object):
  File "/home/webhosting/ws.dev.savvy.cz/www/service/Project365APIWebServices.py", line 65, in Project365APIWebServices
    @ladonize(PORTABLE_STRING, Customer, rtype=bool)
  File "/python3/lib/python3.2/site-packages/ladon-0.7.0-py3.2.egg/ladon/ladonizer/decorator.py", line 88, in decorator
    ladon_method_info = global_service_collection().add_service_method(f,*def_args,**def_kw)
  File "/python3/lib/python3.2/site-packages/ladon-0.7.0-py3.2.egg/ladon/ladonizer/collection.py", line 132, in add_service_method
    method = self.services[(src_fname,clsname)].add_method(f,*def_args,**def_kw)
  File "/python3/lib/python3.2/site-packages/ladon-0.7.0-py3.2.egg/ladon/ladonizer/collection.py", line 230, in add_method
    method = LadonMethodInfo(self,f,*def_args,**def_kw)
  File "/python3/lib/python3.2/site-packages/ladon-0.7.0-py3.2.egg/ladon/ladonizer/collection.py", line 394, in __init__
    self._multipart_request_required |= sinfo.typemanager.analyze_param(def_args[argidx])
  File "/python3/lib/python3.2/site-packages/ladon-0.7.0-py3.2.egg/ladon/types/typemanager.py", line 156, in analyze_param
    self.analyze_class(param)
  File "/python3/lib/python3.2/site-packages/ladon-0.7.0-py3.2.egg/ladon/types/typemanager.py", line 115, in analyze_class
    if inspect.getmro(attr_val).count(LadonType):
  File "/python3/lib/python3.2/inspect.py", line 344, in getmro
    return cls.__mro__
AttributeError: 'list' object has no attribute '__mro__'

Could you advice me, what's wrong?

Thanks Ales

Question information

Language:
English Edit question
Status:
Solved
For:
ladon Edit question
Assignee:
jsgaarde Edit question
Solved by:
jsgaarde
Solved:
2012-02-16
Last query:
2012-02-16
Last reply:
2012-02-11
Best jsgaarde (jakob-simon-gaarde) said : #1

Hi Ales.

I think it is because you are using new-style type definition with a list, which is not yet supported. It's actually not nessecary to set a list nullable like you do, cause lists are always nullable (Ladon converts a null list value to an empty list and visa versa)

Best Regards
Jakob Simon-Gaarde

jsgaarde (jakob-simon-gaarde) said : #2

Hi Ales.

I think it is because you are using new-style type definition with a list, which is not yet supported. It's actually not nessecary to set a list nullable like you do, cause lists are always nullable (Ladon converts a null list value to an empty list and visa versa)

Best Regards
Jakob Simon-Gaarde

Ales Klimsa (ales-klimsa) said : #3

yes, you are right
thanks for help

Ales Klimsa (ales-klimsa) said : #4

Thanks jsgaarde, that solved my question.