~salvatore-orlando/neutron/bug814518

« back to all changes in this revision

Viewing changes to quantum/common/utils.py

* Merged changes from Salvatore's branch - quantum-api-workinprogress
* Removed spurious methods from quantum_base_plugin class.
* Updated the sample plugins to be compliant with the new QuantumBase class.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
import sys
30
30
import ConfigParser
31
31
 
32
 
from common import exceptions
 
32
import exceptions as exception
 
33
import flags
33
34
from exceptions import ProcessExecutionError
34
35
 
35
36
 
36
37
TIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
37
 
 
 
38
FLAGS = flags.FLAGS
38
39
 
39
40
def int_from_bool_as_string(subject):
40
41
    """
71
72
    """Returns a class from a string including module and class"""
72
73
    mod_str, _sep, class_str = import_str.rpartition('.')
73
74
    try:
 
75
        #mod_str = os.path.join(FLAGS.state_path, mod_str)
74
76
        __import__(mod_str)
75
77
        return getattr(sys.modules[mod_str], class_str)
76
 
    except (ImportError, ValueError, AttributeError):
 
78
    except (ImportError, ValueError, AttributeError) as e:
 
79
        print e
77
80
        raise exception.NotFound('Class %s cannot be found' % class_str)
78
81
 
79
82