You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
type object 'Sport' has no attribute ''
Traceback (most recent call last):
File "venv/lib64/python3.4/site-packages/ripozo_sqlalchemy/alchemymanager.py", line 102, in _get_field_python_type
return getattr(model, name).property.columns[0].type.python_type
File "venv/lib64/python3.4/site-packages/sqlalchemy/util/langhelpers.py", line 840, in __getattr__
return self._fallback_getattr(key)
File "venv/lib64/python3.4/site-packages/sqlalchemy/util/langhelpers.py", line 818, in _fallback_getattr
raise AttributeError(key)
AttributeError: columns
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "venv/lib64/python3.4/site-packages/ripozo_sqlalchemy/alchemymanager.py", line 102, in _get_field_python_type
return getattr(model, name).property.columns[0].type.python_type
AttributeError: type object 'Sport' has no attribute ''
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "venv/lib64/python3.4/site-packages/flask_ripozo/dispatcher.py", line 213, in flask_dispatch
adapter = dispatcher.dispatch(f, accepted_mimetypes, ripozo_request)
File "venv/lib64/python3.4/site-packages/ripozo/dispatch_base.py", line 212, in dispatch
result = endpoint_func(request, *args, **kwargs)
File "venv/lib64/python3.4/site-packages/ripozo/decorators.py", line 103, in newfunc
return self.func(klass, *args)
File "venv/lib64/python3.4/site-packages/ripozo/decorators.py", line 197, in wrapped
resource = func(cls, request, *args, **kwargs)
File "venv/lib64/python3.4/site-packages/ripozo/decorators.py", line 111, in __call__
return self.__get__(None, klass=cls)(*args, **kwargs)
File "venv/lib64/python3.4/site-packages/ripozo/decorators.py", line 103, in newfunc
return self.func(klass, *args)
File "venv/lib64/python3.4/site-packages/ripozo/decorators.py", line 367, in action
translate_fields(request, self.fields(cls.manager),
File "venv/lib64/python3.4/site-packages/ripozo/decorators.py", line 382, in fields
for field in manager.field_validators:
File "venv/lib64/python3.4/site-packages/ripozo/decorators.py", line 33, in __get__
return self.fget.__get__(obj, klass)()
File "venv/lib64/python3.4/site-packages/ripozo/manager_base.py", line 208, in field_validators
cls._field_validators[field_name] = cls.get_field_type(field_name)
File "venv/lib64/python3.4/site-packages/ripozo_sqlalchemy/alchemymanager.py", line 123, in get_field_type
python_type = cls._get_field_python_type(cls.model, name)
File "venv/lib64/python3.4/site-packages/ripozo_sqlalchemy/alchemymanager.py", line 106, in _get_field_python_type
return AlchemyManager._get_field_python_type(model, '.'.join(parts))
File "venv/lib64/python3.4/site-packages/ripozo_sqlalchemy/alchemymanager.py", line 105, in _get_field_python_type
model = getattr(model, parts.pop(0)).comparator.mapper.class_
AttributeError: type object 'Sport' has no attribute ''
127.0.0.1 - - [25/Apr/2016 20:24:18] "GET /courses/117/ HTTP/1.1" 500 -
Traceback (most recent call last):
File "venv/lib/python3.4/site-packages/flask/app.py", line 1836, in __call__
return self.wsgi_app(environ, start_response)
File "venv/lib/python3.4/site-packages/flask/app.py", line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "venv/lib/python3.4/site-packages/flask/app.py", line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "venv/lib/python3.4/site-packages/flask/_compat.py", line 33, in reraise
raise value
File "venv/lib/python3.4/site-packages/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "venv/lib/python3.4/site-packages/flask/app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "venv/lib/python3.4/site-packages/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "venv/lib/python3.4/site-packages/flask/_compat.py", line 33, in reraise
raise value
File "venv/lib/python3.4/site-packages/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "venv/lib/python3.4/site-packages/flask/app.py", line 1461, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "venv/lib/python3.4/site-packages/flask_ripozo/dispatcher.py", line 216, in flask_dispatch
return dispatcher.error_handler(dispatcher, accepted_mimetypes, e)
File "venv/lib/python3.4/site-packages/flask_ripozo/dispatcher.py", line 51, in exception_handler
raise exc
File "venv/lib/python3.4/site-packages/flask_ripozo/dispatcher.py", line 213, in flask_dispatch
adapter = dispatcher.dispatch(f, accepted_mimetypes, ripozo_request)
File "venv/lib/python3.4/site-packages/ripozo/dispatch_base.py", line 212, in dispatch
result = endpoint_func(request, *args, **kwargs)
File "venv/lib/python3.4/site-packages/ripozo/decorators.py", line 103, in newfunc
return self.func(klass, *args)
File "venv/lib/python3.4/site-packages/ripozo/decorators.py", line 197, in wrapped
resource = func(cls, request, *args, **kwargs)
File "venv/lib/python3.4/site-packages/ripozo/decorators.py", line 111, in __call__
return self.__get__(None, klass=cls)(*args, **kwargs)
File "venv/lib/python3.4/site-packages/ripozo/decorators.py", line 103, in newfunc
return self.func(klass, *args)
File "venv/lib/python3.4/site-packages/ripozo/decorators.py", line 367, in action
translate_fields(request, self.fields(cls.manager),
File "venv/lib/python3.4/site-packages/ripozo/decorators.py", line 382, in fields
for field in manager.field_validators:
File "venv/lib/python3.4/site-packages/ripozo/decorators.py", line 33, in __get__
return self.fget.__get__(obj, klass)()
File "venv/lib/python3.4/site-packages/ripozo/manager_base.py", line 208, in field_validators
cls._field_validators[field_name] = cls.get_field_type(field_name)
File "venv/lib/python3.4/site-packages/ripozo_sqlalchemy/alchemymanager.py", line 123, in get_field_type
python_type = cls._get_field_python_type(cls.model, name)
File "venv/lib/python3.4/site-packages/ripozo_sqlalchemy/alchemymanager.py", line 106, in _get_field_python_type
return AlchemyManager._get_field_python_type(model, '.'.join(parts))
File "venv/lib/python3.4/site-packages/ripozo_sqlalchemy/alchemymanager.py", line 105, in _get_field_python_type
model = getattr(model, parts.pop(0)).comparator.mapper.class_
AttributeError: type object 'Sport' has no attribute ''
But even when I remove that and return just object, as it was previously before 4445a19 I still get weird errors.
Traceback (most recent call last):
File "venv/lib/python3.4/site-packages/flask/app.py", line 1836, in __call__
return self.wsgi_app(environ, start_response)
File "venv/lib/python3.4/site-packages/flask/app.py", line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "venv/lib/python3.4/site-packages/flask/app.py", line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "venv/lib/python3.4/site-packages/flask/_compat.py", line 33, in reraise
raise value
File "venv/lib/python3.4/site-packages/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "venv/lib/python3.4/site-packages/flask/app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "venv/lib/python3.4/site-packages/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "venv/lib/python3.4/site-packages/flask/_compat.py", line 33, in reraise
raise value
File "venv/lib/python3.4/site-packages/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "venv/lib/python3.4/site-packages/flask/app.py", line 1461, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "venv/lib/python3.4/site-packages/flask_ripozo/dispatcher.py", line 218, in flask_dispatch
return Response(response=adapter.formatted_body, headers=adapter.extra_headers,
File "venv/lib/python3.4/site-packages/ripozo/adapters/basic_json.py", line 59, in formatted_body
return json.dumps({self.resource.resource_name: response})
File "/usr/lib64/python3.4/json/__init__.py", line 230, in dumps
return _default_encoder.encode(obj)
File "/usr/lib64/python3.4/json/encoder.py", line 192, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib64/python3.4/json/encoder.py", line 250, in iterencode
return _iterencode(o, 0)
File "/usr/lib64/python3.4/json/encoder.py", line 173, in default
raise TypeError(repr(o) + " is not JSON serializable")
TypeError: <__main__.Sport object at 0x7f0079dc62e8> is not JSON serializable
What am I doing wrong? I've spend couple of hours trying and I'm clueless.
Thanks for any help.
The text was updated successfully, but these errors were encountered:
You can include 'sport.id' in which case it'll return something like {'sport': {'id': 1}} You're right that it should be a more explicit exception though.
Given the following example (search for
HERE IS THE PROBLEM
):If I GET /courses/1/, I get a nasty exception:
The problem is here: https://github.com/vertical-knowledge/ripozo-sqlalchemy/blob/master/ripozo_sqlalchemy/alchemymanager.py#L106
The joined part is empty string.
But even when I remove that and return just object, as it was previously before 4445a19 I still get weird errors.
What am I doing wrong? I've spend couple of hours trying and I'm clueless.
Thanks for any help.
The text was updated successfully, but these errors were encountered: