def _raise_catalog_multiple_sub_node_ul(sub_node_list):
    error_message = _message_config_local['err']['chm_catalog_multiple_sub_node_ul'] \
        + str(sub_node_list)

    _crLog.crPrintCyan(error_message)

    raise _crException.CrNotImplementedError(error_message)
def _raise_catalog_object_tag_not_fount():
    error_message = _message_config_local['err'][
        'catalog_object_tag_not_fount']

    _crLog.crPrintCyan(error_message)

    raise _crException.CrObjectTagNotFoundInCatalogChmError(error_message)
Пример #3
0
def _load_magic_value_config():
    magic_value_config_path = _plPath(
        _crGlobalLevel.environment_config['dev']['magic_value_config_path'])

    if _osPath.exists(magic_value_config_path) is False:
        error_message = _crGlobalLevel.message_config['err']['software_broken'] \
            + str(magic_value_config_path)
        _crLog.crPrintCyan(error_message)
        raise _crException.CrFileNotFoundError(error_message)

    _crGlobalLevel.magic_value_config.read(magic_value_config_path)
Пример #4
0
def copy_catalog_html_resource(output_folder_path):
    try:
        data_catalog_html_resource_root_full_path = _plPath(
            _environment_config_local['data_catalog_html_resource']
            ['root_full_path'])

        _copytree(data_catalog_html_resource_root_full_path,
                  output_folder_path,
                  dirs_exist_ok=True)
    except:
        error_message = _message_config_local['err']['failed_to_copy_file']
        _crLog.crPrintCyan(error_message)
        raise
Пример #5
0
def crCreateFolder(myFolder):
    folder_exist = False
    if _osPath.exists(myFolder) is False:
        try:
            _os.mkdir(myFolder)
            folder_exist = True
        except:
            error_message = _message_config_local['err'][
                'failed_to_create_output_folder']
            _crLog.crPrintCyan(error_message)
            raise _crException.CrEnvironmentError(error_message)
    # else if myFolder already exist
    else:
        folder_exist = True  # TODO: Undocumented behavior, should we actually ignore the folder exist problem?
Пример #6
0
def _load_environment_config():
    environment_config_path = _plPath('environment.ini')

    if _osPath.exists(environment_config_path) is False:
        # Message config not yet loaded
        error_message = "Config file missing: " + str(environment_config_path)
        _crLog.crPrintCyan(error_message)
        raise _crException.CrFileNotFoundError(error_message)

    _crGlobalLevel.environment_config.read(environment_config_path)

    # Apply locale
    _crGlobalLevel.environment_config = _crLocale.apply_locale_to_environment_config(
        _crGlobalLevel.environment_config)
Пример #7
0
def _load_message_config():
    message_config_path = _plPath(
        _crGlobalLevel.environment_config['message']['config_message_path'])

    if _osPath.exists(message_config_path) is False:
        # Message config not yet loaded
        error_message = "Config file missing: " + str(message_config_path)
        _crLog.crPrintCyan(error_message)
        raise _crException.CrFileNotFoundError(error_message)

    _crGlobalLevel.message_config.read(message_config_path, encoding='utf-8')

    # Apply preprocessor
    _crGlobalLevel.message_config = _crMessageConfigPreprocess.apply_message_config_preprocessor(
        _crGlobalLevel.message_config)
def _process_my_soup(mySoup):
    catalog_node = None

    # For now, it can support only one root node
    # Count root node here for later raise an error
    ulCount = 0
    for child in mySoup.body.contents:
        # Filter all ul tag
        if child.name != "ul":
            continue

        ulCount = ulCount + 1
        if ulCount > 1:
            error_message = _message_config_local['err']['chm_catalog_multiple_sub_node_ul'] \
                + str(child)
            _crLog.crPrintCyan(error_message)
            raise _crException.CrNotImplementedError(error_message)
        else:
            # Process ul tag found
            catalog_node = _process_catalog_ul(child)

    return catalog_node