← Back to team overview

openstack-poc team mailing list archive

[Bug 972859] Re: Fix utils.import_object() when trying to get an instance of a class

 

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

commit 4acd7829ab0857356594dce3b841f4d785cf2aa1
Author: Russell Bryant <rbryant@xxxxxxxxxx>
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

-- 
You received this bug notification because you are a member of OpenStack
Common Drivers, which is the registrant for openstack-common.
https://bugs.launchpad.net/bugs/972859

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

Status in openstack-common:
  Fix Committed

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).

To manage notifications about this bug go to:
https://bugs.launchpad.net/openstack-common/+bug/972859/+subscriptions


References