##// END OF EJS Templates
extensions: preparatory refactoring...
Thomas De Schampheleire -
r8420:2228102b default
parent child Browse files
Show More
@@ -521,24 +521,25 b' def repo2db_mapper(initial_repo_dict, re'
521
521
522
522
523 def load_extensions(root_path):
523 def load_extensions(root_path):
524 path = os.path.join(root_path, 'rcextensions', '__init__.py')
524 try:
525 if os.path.isfile(path):
525 ext = create_module('rc', os.path.join(root_path, 'rcextensions', '__init__.py'))
526 ext = create_module('rc', path)
526 except FileNotFoundError:
527 kallithea.EXTENSIONS = ext
527 return
528 log.debug('Found rcextensions now loading %s...', ext)
529
528
530 # Additional mappings that are not present in the pygments lexers
529 log.info('Loaded rcextensions from %s', ext)
531 kallithea.config.conf.LANGUAGES_EXTENSIONS_MAP.update(getattr(ext, 'EXTRA_MAPPINGS', {}))
530 kallithea.EXTENSIONS = ext
532
531
533 # OVERRIDE OUR EXTENSIONS FROM RC-EXTENSIONS (if present)
532 # Additional mappings that are not present in the pygments lexers
533 kallithea.config.conf.LANGUAGES_EXTENSIONS_MAP.update(getattr(ext, 'EXTRA_MAPPINGS', {}))
534
534
535 if getattr(ext, 'INDEX_EXTENSIONS', []):
535 # Override any INDEX_EXTENSIONS
536 log.debug('settings custom INDEX_EXTENSIONS')
536 if getattr(ext, 'INDEX_EXTENSIONS', []):
537 kallithea.config.conf.INDEX_EXTENSIONS = getattr(ext, 'INDEX_EXTENSIONS', [])
537 log.debug('settings custom INDEX_EXTENSIONS')
538 kallithea.config.conf.INDEX_EXTENSIONS = getattr(ext, 'INDEX_EXTENSIONS', [])
538
539
539 # ADDITIONAL MAPPINGS
540 # Additional INDEX_EXTENSIONS
540 log.debug('adding extra into INDEX_EXTENSIONS')
541 log.debug('adding extra into INDEX_EXTENSIONS')
541 kallithea.config.conf.INDEX_EXTENSIONS.extend(getattr(ext, 'EXTRA_INDEX_EXTENSIONS', []))
542 kallithea.config.conf.INDEX_EXTENSIONS.extend(getattr(ext, 'EXTRA_INDEX_EXTENSIONS', []))
542
543
543
544
544 #==============================================================================
545 #==============================================================================
General Comments 0
You need to be logged in to leave comments. Login now