Fix utils.import_object() when trying to get an instance of a class

Bug #972859 reported by Russell Bryant
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
openstack-common
Fix Released
Medium
Russell Bryant

Bug Description

RIght now, utils.import_object('foo') is the same as utils.import_class('foo') when 'foo' is the path to a class. This should be fixed so that import_object() returns an instance of that class (like how this works in nova.utils).

Changed in openstack-common:
assignee: nobody → Russell Bryant (russellb)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to openstack-common (master)

Fix proposed to branch: master
Review: https://review.openstack.org/6191

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

Reviewed: https://review.openstack.org/6191
Committed: http://github.com/openstack/openstack-common/commit/4acd7829ab0857356594dce3b841f4d785cf2aa1
Submitter: Jenkins
Branch: master

commit 4acd7829ab0857356594dce3b841f4d785cf2aa1
Author: Russell Bryant <email address hidden>
Date: Tue Apr 3 17:05:37 2012 -0400

    Change behavior in utils.import_object().

    Fix bug 972859.

    Prior to this patch, utils.import_object(foo) and
    utils.import_class(foo) would return the same thing if foo was the path
    to a class. This patch changes utils.import_object() to return an
    instance of the class, instead, also allowing you to pass in arguments
    to the constructor.

    This patch also removes the odd behavior of import_object() to be able
    to also import a module. Instead, a new function import_module() has
    been added.

    Finally, the three import helpers have been moved to a new module,
    importutils.

    Change-Id: Ia2ea64c965692f8c3a29adec332dd93a83980070

Changed in openstack-common:
status: In Progress → Fix Committed
Mark McLoughlin (markmc)
Changed in openstack-common:
status: Fix Committed → Fix Released
importance: Undecided → Medium
milestone: none → 2012.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.