Hello, thanks for the quick answer and fix for my other tickets. I left a comment on #12, but I created a new one for traceability (and making sure you didn't miss it since it is closed).
I think there is some bits left to correct in the nullable relationship. So, it turns out that I have a new use case for this nullable relationship. So, if I include my relationship with /api/a_item?include=b_item all is good. But if I need to go deeper to retrieve relationship of b_item, for instance /api/a_item?include=b_item,b_item.d_item, then if there is a empty (resulting in None/Null) b_item, it fails with the similar error with the following traceback.
Probably the by-pass for a None array is missing when retrieving "child" relationship (like the d_item).
Thanks again for your support!
Traceback (most recent call last):
File "C:\dev\deliverables\venv\Lib\site-packages\flask\app.py", line 2464, in __call__
return self.wsgi_app(environ, start_response)
File "C:\dev\deliverables\venv\Lib\site-packages\flask\app.py", line 2450, in wsgi_app
response = self.handle_exception(e)
File "C:\dev\deliverables\venv\Lib\site-packages\flask\app.py", line 1867, in handle_exception
reraise(exc_type, exc_value, tb)
File "C:\dev\deliverables\venv\Lib\site-packages\flask\_compat.py", line 39, in reraise
raise value
File "C:\dev\deliverables\venv\Lib\site-packages\flask\app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "C:\dev\deliverables\venv\Lib\site-packages\flask\app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\dev\deliverables\venv\Lib\site-packages\flask\app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "C:\dev\deliverables\venv\Lib\site-packages\flask\_compat.py", line 39, in reraise
raise value
File "C:\dev\deliverables\venv\Lib\site-packages\flask\app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "C:\dev\deliverables\venv\Lib\site-packages\flask\app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "C:\dev\deliverables\venv\Lib\site-packages\mimerender.py", line 244, in wrapper
result = target(*args, **kwargs)
File "C:\dev\deliverables\venv\Lib\site-packages\flask_restless\views\base.py", line 380, in new_func
return func(*args, **kw)
File "C:\dev\deliverables\venv\Lib\site-packages\flask_restless\views\base.py", line 347, in new_func
return func(*args, **kw)
File "C:\dev\deliverables\venv\Lib\site-packages\flask_restless\views\base.py", line 233, in new_func
return func(*args, **kw)
File "C:\dev\deliverables\venv\Lib\site-packages\flask\views.py", line 89, in view
return self.dispatch_request(*args, **kwargs)
File "C:\dev\deliverables\venv\Lib\site-packages\flask\views.py", line 163, in dispatch_request
return meth(*args, **kwargs)
File "C:\dev\deliverables\venv\Lib\site-packages\flask_restless\views\base.py", line 429, in wrapped
return func(*args, **kw)
File "C:\dev\deliverables\venv\Lib\site-packages\flask_restless\views\resources.py", line 330, in get
return self._get_collection()
File "C:\dev\deliverables\venv\Lib\site-packages\flask_restless\views\resources.py", line 300, in _get_collection
return self._get_collection_helper(filters=filters, sort=sort,
File "C:\dev\deliverables\venv\Lib\site-packages\flask_restless\views\base.py", line 1612, in _get_collection_helper
included = self.get_all_inclusions(instances)
File "C:\dev\deliverables\venv\Lib\site-packages\flask_restless\views\base.py", line 1295, in get_all_inclusions
to_include = set(chain(self.resources_to_include(resource)
File "C:\dev\deliverables\venv\Lib\site-packages\flask_restless\views\base.py", line 1295, in <genexpr>
to_include = set(chain(self.resources_to_include(resource)
File "C:\dev\deliverables\venv\Lib\site-packages\flask_restless\views\base.py", line 1667, in resources_to_include
return set(chain(resources_from_path(instance, path)
File "C:\dev\deliverables\venv\Lib\site-packages\flask_restless\views\base.py", line 616, in resources_from_path
if is_like_list(resource, relation):
File "C:\dev\deliverables\venv\Lib\site-packages\flask_restless\helpers.py", line 236, in is_like_list
if relation in instance._sa_class_manager:
AttributeError: 'NoneType' object has no attribute '_sa_class_manager'
Hello, thanks for the quick answer and fix for my other tickets. I left a comment on #12, but I created a new one for traceability (and making sure you didn't miss it since it is closed).
I think there is some bits left to correct in the nullable relationship. So, it turns out that I have a new use case for this nullable relationship. So, if I include my relationship with
/api/a_item?include=b_item
all is good. But if I need to go deeper to retrieve relationship of b_item, for instance/api/a_item?include=b_item,b_item.d_item
, then if there is a empty (resulting in None/Null) b_item, it fails with the similar error with the following traceback.Probably the by-pass for a None array is missing when retrieving "child" relationship (like the d_item).
Thanks again for your support!
Originally posted by @sharky98 in https://github.com/mrevutskyi/flask-restless-ng/issues/12#issuecomment-814601751