##// END OF EJS Templates
extensions: rename internal names away from 'rcextensions'...
Thomas De Schampheleire -
r8419:ec73bce9 default
parent child Browse files
Show More
@@ -28,7 +28,7 b' import kallithea'
28 import kallithea.bin.kallithea_cli_base as cli_base
28 import kallithea.bin.kallithea_cli_base as cli_base
29 from kallithea.lib.indexers.daemon import WhooshIndexingDaemon
29 from kallithea.lib.indexers.daemon import WhooshIndexingDaemon
30 from kallithea.lib.pidlock import DaemonLock, LockHeld
30 from kallithea.lib.pidlock import DaemonLock, LockHeld
31 from kallithea.lib.utils import load_rcextensions
31 from kallithea.lib.utils import load_extensions
32 from kallithea.model.repo import RepoModel
32 from kallithea.model.repo import RepoModel
33
33
34
34
@@ -41,7 +41,7 b' def index_create(repo_location, index_on'
41 """Create or update full text search index"""
41 """Create or update full text search index"""
42
42
43 index_location = kallithea.CONFIG['index_dir']
43 index_location = kallithea.CONFIG['index_dir']
44 load_rcextensions(kallithea.CONFIG['here'])
44 load_extensions(kallithea.CONFIG['here'])
45
45
46 if not repo_location:
46 if not repo_location:
47 repo_location = RepoModel().repos_path
47 repo_location = RepoModel().repos_path
@@ -34,7 +34,7 b' import kallithea.lib.locale'
34 import kallithea.model.base
34 import kallithea.model.base
35 import kallithea.model.meta
35 import kallithea.model.meta
36 from kallithea.lib import celerypylons
36 from kallithea.lib import celerypylons
37 from kallithea.lib.utils import check_git_version, load_rcextensions, set_app_settings, set_indexer_config, set_vcs_config
37 from kallithea.lib.utils import check_git_version, load_extensions, set_app_settings, set_indexer_config, set_vcs_config
38 from kallithea.lib.utils2 import asbool
38 from kallithea.lib.utils2 import asbool
39 from kallithea.model import db
39 from kallithea.model import db
40
40
@@ -139,7 +139,7 b' def setup_configuration(app):'
139 kallithea.CELERY_APP = celerypylons.make_app()
139 kallithea.CELERY_APP = celerypylons.make_app()
140 kallithea.CONFIG = config
140 kallithea.CONFIG = config
141
141
142 load_rcextensions(root_path=config['here'])
142 load_extensions(root_path=config['here'])
143
143
144 set_app_settings(config)
144 set_app_settings(config)
145
145
@@ -520,32 +520,25 b' def repo2db_mapper(initial_repo_dict, re'
520 return added, removed
520 return added, removed
521
521
522
522
523 def load_rcextensions(root_path):
523 def load_extensions(root_path):
524 path = os.path.join(root_path, 'rcextensions', '__init__.py')
524 path = os.path.join(root_path, 'rcextensions', '__init__.py')
525 if os.path.isfile(path):
525 if os.path.isfile(path):
526 rcext = create_module('rc', path)
526 ext = create_module('rc', path)
527 EXT = kallithea.EXTENSIONS = rcext
527 kallithea.EXTENSIONS = ext
528 log.debug('Found rcextensions now loading %s...', rcext)
528 log.debug('Found rcextensions now loading %s...', ext)
529
529
530 # Additional mappings that are not present in the pygments lexers
530 # Additional mappings that are not present in the pygments lexers
531 kallithea.config.conf.LANGUAGES_EXTENSIONS_MAP.update(getattr(EXT, 'EXTRA_MAPPINGS', {}))
531 kallithea.config.conf.LANGUAGES_EXTENSIONS_MAP.update(getattr(ext, 'EXTRA_MAPPINGS', {}))
532
532
533 # OVERRIDE OUR EXTENSIONS FROM RC-EXTENSIONS (if present)
533 # OVERRIDE OUR EXTENSIONS FROM RC-EXTENSIONS (if present)
534
534
535 if getattr(EXT, 'INDEX_EXTENSIONS', []):
535 if getattr(ext, 'INDEX_EXTENSIONS', []):
536 log.debug('settings custom INDEX_EXTENSIONS')
536 log.debug('settings custom INDEX_EXTENSIONS')
537 kallithea.config.conf.INDEX_EXTENSIONS = getattr(EXT, 'INDEX_EXTENSIONS', [])
537 kallithea.config.conf.INDEX_EXTENSIONS = getattr(ext, 'INDEX_EXTENSIONS', [])
538
538
539 # ADDITIONAL MAPPINGS
539 # ADDITIONAL MAPPINGS
540 log.debug('adding extra into INDEX_EXTENSIONS')
540 log.debug('adding extra into INDEX_EXTENSIONS')
541 kallithea.config.conf.INDEX_EXTENSIONS.extend(getattr(EXT, 'EXTRA_INDEX_EXTENSIONS', []))
541 kallithea.config.conf.INDEX_EXTENSIONS.extend(getattr(ext, 'EXTRA_INDEX_EXTENSIONS', []))
542
543 # auto check if the module is not missing any data, set to default if is
544 # this will help autoupdate new feature of rcext module
545 #from kallithea.config import rcextensions
546 #for k in dir(rcextensions):
547 # if not k.startswith('_') and not hasattr(EXT, k):
548 # setattr(EXT, k, getattr(rcextensions, k))
549
542
550
543
551 #==============================================================================
544 #==============================================================================
General Comments 0
You need to be logged in to leave comments. Login now