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_ |
|
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_ |
|
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_ |
|
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_ |
|
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_ |
|
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 |
|
|
526 | ext = create_module('rc', path) | |
527 |
|
|
527 | kallithea.EXTENSIONS = ext | |
528 |
log.debug('Found rcextensions now loading %s...', |
|
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( |
|
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( |
|
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( |
|
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( |
|
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