error using generated link for collection with parameter defaulted to None

Bug #1665779 reported by Thomas Maddox
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
craton
Fix Released
High
Thomas Maddox

Bug Description

With the addition of relational links for pagination of collections from Craton API, an issue was encountered for collections with parameters defaulted to "None" when using the link generated by the _link_params_for method.

You can recreate like so: http://paste.openstack.org/show/599468/

Revision history for this message
Thomas Maddox (thomas-maddox) wrote :
Download full text (4.3 KiB)

Traceback:

172.17.0.1 - - [17/Feb/2017 19:52:17] "GET /v1/projects?name=None&sort_keys=created_at%2Cid&limit=30&id=None&sort_dir=asc HTTP/1.1" 500 59
Traceback (most recent call last):
  File "/usr/lib/python3.5/wsgiref/handlers.py", line 137, in run
    self.result = application(self.environ, self.start_response)
  File "/craton/lib/python3.5/site-packages/webob/dec.py", line 131, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/craton/lib/python3.5/site-packages/webob/dec.py", line 196, in call_func
    return self.func(req, *args, **kwargs)
  File "/craton/lib/python3.5/site-packages/oslo_middleware/request_id.py", line 37, in __call__
    response = req.get_response(self.application)
  File "/craton/lib/python3.5/site-packages/webob/request.py", line 1316, in send
    application, catch_exc_info=False)
  File "/craton/lib/python3.5/site-packages/webob/request.py", line 1280, in call_application
    app_iter = application(self.environ, start_response)
  File "/craton/lib/python3.5/site-packages/webob/dec.py", line 131, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/craton/lib/python3.5/site-packages/webob/dec.py", line 196, in call_func
    return self.func(req, *args, **kwargs)
  File "/craton/lib/python3.5/site-packages/oslo_middleware/base.py", line 126, in __call__
    response = req.get_response(self.application)
  File "/craton/lib/python3.5/site-packages/webob/request.py", line 1316, in send
    application, catch_exc_info=False)
  File "/craton/lib/python3.5/site-packages/webob/request.py", line 1280, in call_application
    app_iter = application(self.environ, start_response)
  File "/craton/lib/python3.5/site-packages/flask/app.py", line 1994, in __call__
    return self.wsgi_app(environ, start_response)
  File "/craton/lib/python3.5/site-packages/flask/app.py", line 1985, in wsgi_app
    response = self.handle_exception(e)
  File "/craton/lib/python3.5/site-packages/flask_restful/__init__.py", line 271, in error_router
    return original_handler(e)
  File "/craton/lib/python3.5/site-packages/flask/app.py", line 1540, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/craton/lib/python3.5/site-packages/flask/_compat.py", line 32, in reraise
    raise value.with_traceback(tb)
  File "/craton/lib/python3.5/site-packages/flask/app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "/craton/lib/python3.5/site-packages/flask/app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/craton/lib/python3.5/site-packages/flask_restful/__init__.py", line 271, in error_router
    return original_handler(e)
  File "/craton/lib/python3.5/site-packages/flask/app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/craton/lib/python3.5/site-packages/flask/_compat.py", line 32, in reraise
    raise value.with_traceback(tb)
  File "/craton/lib/python3.5/site-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/craton/lib/python3.5/site-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](*...

Read more...

Changed in craton:
assignee: nobody → Thomas Maddox (thomas-maddox)
status: New → In Progress
Changed in craton:
milestone: none → v0.1.0
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to craton (master)

Reviewed: https://review.openstack.org/435595
Committed: https://git.openstack.org/cgit/openstack/craton/commit/?id=a20172dd3ce339bbef4bae550c403f8568a7b40d
Submitter: Jenkins
Branch: master

commit a20172dd3ce339bbef4bae550c403f8568a7b40d
Author: Thomas Maddox <email address hidden>
Date: Fri Feb 17 20:53:26 2017 +0000

    Ignore None param values when generating links

    This patch includes a branch to tell _link_params_for
    to skip params that have a None value when generating
    its links.

    Change-Id: I6182028dec94b010ea79a0f281f17d3f70f3b202
    Closes-Bug: 1665779

Changed in craton:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.