should not use mutable default arguments

Bug #1525903 reported by javeme
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Undecided
javeme

Bug Description

We should not use mutable default arguments in function definitions due to the "Common Gotchas"[1].

So, we must remove the default arguments "[]" when the function is defined, such as this function:
https://github.com/openstack/horizon/blob/master/openstack_dashboard/utils/metering.py#L178

[1]: http://docs.python-guide.org/en/latest/writing/gotchas/

Changed in horizon:
assignee: nobody → javeme (javaloveme)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/256931
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=db8e206bee856fe838b381e5dc8eb47706f50b5b
Submitter: Jenkins
Branch: master

commit db8e206bee856fe838b381e5dc8eb47706f50b5b
Author: Javeme <email address hidden>
Date: Sat Dec 12 18:28:58 2015 +0800

    remove the default arguments "[]"

    remove the default arguments "[]" when the function is defined.
    ref: http://docs.python-guide.org/en/latest/writing/gotchas/

    Closes-Bug: #1525903
    Change-Id: I241f22fe10e535bb50f7ce27fac09d6448fd2bb2

Changed in horizon:
status: In Progress → Fix Released
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/horizon 9.0.0.0b2

This issue was fixed in the openstack/horizon 9.0.0.0b2 development milestone.

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.