Closed bquiero closed 4 years ago
The example was outdated, I fixed it. Thanks for the heads-up. I'm also very happy that you find Spyne useful, thank you for the kind words.
Please note that questions go either to the mailing list or Stackoverflow. I don't answer questions in the issue tracker.
Thank you very much!
For the next I will use StackOverflow or the mailing list.
Hello, First of all thank you for the work, spyne is the best way i have found to use web RPC in python.
I am following the spyne tutorial. I was able to do the basic tutorial and the complexModel tutorial without much problem. Now I am trying to run the example server_sqlalchemy.py I have copied the file as is, just add the database in sql. When I try to run I get the following error:
Traceback (most recent call last): File "serverEjemplo/server_sqlalchemy.py", line 78, in <module> class User(TableModel): File "serverEjemplo/server_sqlalchemy.py", line 87, in User permissions = Array(Permission).store_as('table') File "/home/braulio/workspace/python/env_proyectospyne/lib/python3.6/site-packages/spyne/model/complex.py", line 1373, in __new__ retval._set_serializer(_serializer, member_name) File "/home/braulio/workspace/python/env_proyectospyne/lib/python3.6/site-packages/spyne/model/complex.py", line 1430, in _set_serializer serializer = serializer.customize(max_occurs=decimal.Decimal('inf')) File "/home/braulio/workspace/python/env_proyectospyne/lib/python3.6/site-packages/spyne/model/complex.py", line 1176, in customize retval._type_info = TypeInfo(cls._type_info) AttributeError: type object 'Permission' has no attribute '_type_info'
Compare the file with the server_basic.py example that is working.
The biggest difference I see is that the Permissions and User classes now inherit from TableModel instead of ComplexModel.
I thought maybe the probme would be the Permissions class, but if I delete permissions in User I get this error:
Traceback (most recent call last): File "serverEjemplo/server_sqlalchemy.py", line 90, in <module> class UserManagerService(Service): File "serverEjemplo/server_sqlalchemy.py", line 124, in UserManagerService @rpc(_returns=Iterable(User)) File "/home/braulio/workspace/python/env_proyectospyne/lib/python3.6/site-packages/spyne/model/complex.py", line 1373, in __new__ retval._set_serializer(_serializer, member_name) File "/home/braulio/workspace/python/env_proyectospyne/lib/python3.6/site-packages/spyne/model/complex.py", line 1430, in _set_serializer serializer = serializer.customize(max_occurs=decimal.Decimal('inf')) File "/home/braulio/workspace/python/env_proyectospyne/lib/python3.6/site-packages/spyne/model/complex.py", line 1176, in customize retval._type_info = TypeInfo(cls._type_info) AttributeError: type object 'User' has no attribute '_type_info'
Maybe I am missing some requirement. I am working with python 3: My requirements file is:
appdirs==1.4.4 attrs==19.3.0 cached-property==1.5.1 certifi==2020.6.20 chardet==3.0.4 click==7.1.2 defusedxml==0.6.0 Flask==1.1.2 Flask-WTF==0.14.3 idna==2.10 isodate==0.6.0 itsdangerous==1.1.0 Jinja2==2.11.2 lxml==4.5.1 MarkupSafe==1.1.1 pkg-resources==0.0.0 pytz==2020.1 requests==2.24.0 requests-toolbelt==0.9.1 six==1.15.0 spyne==2.13.15 SQLAlchemy==1.3.18 urllib3==1.25.9 Werkzeug==1.0.1 WTForms==2.3.1 zeep==3.4.0