]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Bug 903684: functions defined twice in utils.py
authorSalvatore Orlando <salvatore.orlando@eu.citrix.com>
Tue, 13 Dec 2011 12:22:59 +0000 (12:22 +0000)
committerSalvatore Orlando <salvatore.orlando@eu.citrix.com>
Tue, 13 Dec 2011 12:23:49 +0000 (12:23 +0000)
Removing duplicate definition for import_class and import_object

Change-Id: Ib651ca7b0f87c36f6d4f51ed2d55745e3576c390

quantum/common/utils.py

index 849337a3b7f4221daac2908de46cfb680aec1ba0..1d425a033d6e94ceec94e157ee0b251b2dd906bc 100644 (file)
@@ -132,28 +132,6 @@ def bool_from_string(subject):
     return False
 
 
-def import_class(import_str):
-    """Returns a class from a string including module and class"""
-    mod_str, _sep, class_str = import_str.rpartition('.')
-    try:
-        #mod_str = os.path.join(FLAGS.state_path, mod_str)
-        __import__(mod_str)
-        return getattr(sys.modules[mod_str], class_str)
-    except (ImportError, ValueError, AttributeError) as e:
-        print e
-        raise exception.ClassNotFound(class_name=class_str)
-
-
-def import_object(import_str):
-    """Returns an object including a module or module and class"""
-    try:
-        __import__(import_str)
-        return sys.modules[import_str]
-    except ImportError:
-        cls = import_class(import_str)
-        return cls()
-
-
 def fetchfile(url, target):
     logging.debug("Fetching %s" % url)
 #    c = pycurl.Curl()