Beispiel #1
0
def try_import(module_name, pypi_package_name, short_message=False):
    """tries importing a module and advises to install
    A corresponding Python package in the case import fails"""
    try:
        load_module(module_name)
    except ImportError, error:
        message = 'Error: ' + unicode(error)
        message += '\n\nPlease run: >pip install %s' % pypi_package_name
        if short_message == False:
            message += '\n\nTo install all the dependencies at once, type:'
            message += '\npip install -r openode_requirements.txt'
        message += '\n\nType ^C to quit.'
        raise OpenodeConfigError(message)
def try_import(module_name, pypi_package_name, short_message=False):
    """tries importing a module and advises to install
    A corresponding Python package in the case import fails"""
    try:
        load_module(module_name)
    except ImportError, error:
        message = 'Error: ' + unicode(error)
        message += '\n\nPlease run: >pip install %s' % pypi_package_name
        if short_message == False:
            message += '\n\nTo install all the dependencies at once, type:'
            message += '\npip install -r openode_requirements.txt'
        message += '\n\nType ^C to quit.'
        raise OpenodeConfigError(message)
Beispiel #3
0
    def __init__(self, requirements=None):
        """loads the settings module and inits some variables
        parameter `requirements` is a dictionary with keys
        as setting names and values - another dictionary, which
        has keys (optional, if noted and required otherwise)::

        * required_value (optional)
        * error_message
        """
        self.settings = load_module(os.environ['DJANGO_SETTINGS_MODULE'])
        self.messages = list()
        self.requirements = requirements
    def __init__(self, requirements=None):
        """loads the settings module and inits some variables
        parameter `requirements` is a dictionary with keys
        as setting names and values - another dictionary, which
        has keys (optional, if noted and required otherwise)::

        * required_value (optional)
        * error_message
        """
        self.settings = load_module(os.environ['DJANGO_SETTINGS_MODULE'])
        self.messages = list()
        self.requirements = requirements
Beispiel #5
0
 def __init__(self, login_module_path):
     from openode.utils.loading import load_module
     self.mod = load_module(login_module_path)
     self.mod_path = login_module_path
     self.read_params()