The _filters function in quantum.api.v2.base is not intuitive

Bug #1092977 reported by Zhongyue Luo
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Low
Zhongyue Luo

Bug Description

The _filters function checks twice whether convert_list_to exists in lines 86 and 91.
This is hard to understand and not intuitive.
We should assign a callable object to convert_list_to and execute it in one place to help understand the flow.
There can be three cases,

1) convert_list_to exists: then just use it directly
2) convert_to exists: the use "lambda values_: [convert_to(x) for x in values_]" as convert_list_to
3) convert_to does not exist: then use "lambda values_: None" as convert_list_to

Then, update res with the return value of convert_list_to(values) if not None or else update with the original value.

Revision history for this message
Maru Newby (maru) wrote :

I don't believe this qualifies as a bug. 'hard to understand and is not readable' implies a non-functional problem that can be addressed with a refactoring effort that does not need require the formal traceability of a bug or blueprint.

I will wait for another quantum core member to weigh in, though, rather than invalidating immediately.

Changed in quantum:
assignee: nobody → Zhongyue Luo (zyluo)
status: New → In Progress
Revision history for this message
Zhongyue Luo (zyluo) wrote :

Maru,
I agree with you. However, apparently Salvatore seems this is a big change to the API logic and requested for a bug report

description: updated
Zhongyue Luo (zyluo)
description: updated
Revision history for this message
Salvatore Orlando (salvatore-orlando) wrote :

It's not a big change, but I'd prefer to track changes in routines which are invoked pretty much at each API call.
I agree it's not a bug, but with launchpad we do not have any tracker type different from a bug or a blueprint.

Changed in quantum:
importance: Undecided → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to quantum (master)

Reviewed: https://review.openstack.org/18363
Committed: http://github.com/openstack/quantum/commit/2b75d6be2cc3bdd0621a198619ee6e1c7a2ff90f
Submitter: Jenkins
Branch: master

commit 2b75d6be2cc3bdd0621a198619ee6e1c7a2ff90f
Author: Zhongyue Luo <email address hidden>
Date: Wed Dec 19 11:31:25 2012 +0800

    Fixes quantum.api.v2.base._filters to be more intuitive

    Converts values in one place and sets dictonary according to the return value

    Fixes bug #1092977

    Change-Id: I05dd9b24a8ab20f8c302c22f5bdda2a80ec90e19

Changed in quantum:
status: In Progress → Fix Committed
Akihiro Motoki (amotoki)
Changed in quantum:
milestone: none → grizzly-3
Thierry Carrez (ttx)
Changed in quantum:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in quantum:
milestone: grizzly-3 → 2013.1
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.