Changeset - ec73bce93d6a
[Not reviewed]
default
0 3 0
Thomas De Schampheleire - 5 years ago 2020-10-09 13:39:08
thomas.de_schampheleire@nokia.com
extensions: rename internal names away from 'rcextensions'

Additionally, get rid of the unnecessary 'EXT' variable in load_extensions.
3 files changed with 12 insertions and 19 deletions:
0 comments (0 inline, 0 general)
kallithea/bin/kallithea_cli_index.py
Show inline comments
 
@@ -28,7 +28,7 @@ import kallithea
 
import kallithea.bin.kallithea_cli_base as cli_base
 
from kallithea.lib.indexers.daemon import WhooshIndexingDaemon
 
from kallithea.lib.pidlock import DaemonLock, LockHeld
 
from kallithea.lib.utils import load_rcextensions
 
from kallithea.lib.utils import load_extensions
 
from kallithea.model.repo import RepoModel
 

	
 

	
 
@@ -41,7 +41,7 @@ def index_create(repo_location, index_on
 
    """Create or update full text search index"""
 

	
 
    index_location = kallithea.CONFIG['index_dir']
 
    load_rcextensions(kallithea.CONFIG['here'])
 
    load_extensions(kallithea.CONFIG['here'])
 

	
 
    if not repo_location:
 
        repo_location = RepoModel().repos_path
kallithea/config/app_cfg.py
Show inline comments
 
@@ -34,7 +34,7 @@ import kallithea.lib.locale
 
import kallithea.model.base
 
import kallithea.model.meta
 
from kallithea.lib import celerypylons
 
from kallithea.lib.utils import check_git_version, load_rcextensions, set_app_settings, set_indexer_config, set_vcs_config
 
from kallithea.lib.utils import check_git_version, load_extensions, set_app_settings, set_indexer_config, set_vcs_config
 
from kallithea.lib.utils2 import asbool
 
from kallithea.model import db
 

	
 
@@ -139,7 +139,7 @@ def setup_configuration(app):
 
        kallithea.CELERY_APP = celerypylons.make_app()
 
    kallithea.CONFIG = config
 

	
 
    load_rcextensions(root_path=config['here'])
 
    load_extensions(root_path=config['here'])
 

	
 
    set_app_settings(config)
 

	
kallithea/lib/utils.py
Show inline comments
 
@@ -520,32 +520,25 @@ def repo2db_mapper(initial_repo_dict, re
 
    return added, removed
 

	
 

	
 
def load_rcextensions(root_path):
 
def load_extensions(root_path):
 
    path = os.path.join(root_path, 'rcextensions', '__init__.py')
 
    if os.path.isfile(path):
 
        rcext = create_module('rc', path)
 
        EXT = kallithea.EXTENSIONS = rcext
 
        log.debug('Found rcextensions now loading %s...', rcext)
 
        ext = create_module('rc', path)
 
        kallithea.EXTENSIONS = ext
 
        log.debug('Found rcextensions now loading %s...', ext)
 

	
 
        # Additional mappings that are not present in the pygments lexers
 
        kallithea.config.conf.LANGUAGES_EXTENSIONS_MAP.update(getattr(EXT, 'EXTRA_MAPPINGS', {}))
 
        kallithea.config.conf.LANGUAGES_EXTENSIONS_MAP.update(getattr(ext, 'EXTRA_MAPPINGS', {}))
 

	
 
        # OVERRIDE OUR EXTENSIONS FROM RC-EXTENSIONS (if present)
 

	
 
        if getattr(EXT, 'INDEX_EXTENSIONS', []):
 
        if getattr(ext, 'INDEX_EXTENSIONS', []):
 
            log.debug('settings custom INDEX_EXTENSIONS')
 
            kallithea.config.conf.INDEX_EXTENSIONS = getattr(EXT, 'INDEX_EXTENSIONS', [])
 
            kallithea.config.conf.INDEX_EXTENSIONS = getattr(ext, 'INDEX_EXTENSIONS', [])
 

	
 
        # ADDITIONAL MAPPINGS
 
        log.debug('adding extra into INDEX_EXTENSIONS')
 
        kallithea.config.conf.INDEX_EXTENSIONS.extend(getattr(EXT, 'EXTRA_INDEX_EXTENSIONS', []))
 

	
 
        # auto check if the module is not missing any data, set to default if is
 
        # this will help autoupdate new feature of rcext module
 
        #from kallithea.config import rcextensions
 
        #for k in dir(rcextensions):
 
        #    if not k.startswith('_') and not hasattr(EXT, k):
 
        #        setattr(EXT, k, getattr(rcextensions, k))
 
        kallithea.config.conf.INDEX_EXTENSIONS.extend(getattr(ext, 'EXTRA_INDEX_EXTENSIONS', []))
 

	
 

	
 
#==============================================================================
0 comments (0 inline, 0 general)