Changeset - e9521559d013
[Not reviewed]
default
0 4 0
Mads Kiilerich (mads) - 5 years ago 2020-12-26 18:23:43
mads@kiilerich.com
cli: only config_file_initialize_app should set global CONFIG; needs_config_file will be passed the config object
4 files changed with 7 insertions and 11 deletions:
0 comments (0 inline, 0 general)
kallithea/__init__.py
Show inline comments
 
@@ -42,7 +42,7 @@ BACKENDS = {
 

	
 
CELERY_APP = None  # set to Celery app instance if using Celery
 

	
 
CONFIG = {}
 
CONFIG = {}  # set to tg.config when TG app is initialized and calls app_cfg
 

	
 
# URL prefix for non repository related links - must start with `/`
 
ADMIN_PREFIX = '/_admin'
kallithea/bin/kallithea_cli_base.py
Show inline comments
 
@@ -76,12 +76,10 @@ def register_command(needs_config_file=F
 
                cp.read_string(read_config(path_to_ini_file, strip_section_prefix=annotated.__name__))
 
                logging.config.fileConfig(cp,
 
                    {'__file__': path_to_ini_file, 'here': os.path.dirname(path_to_ini_file)})
 
                if config_file_initialize_app:
 
                    if needs_config_file:  # special case for db creation: also call annotated function (with config parameter) *before* app initialization
 
                if needs_config_file:
 
                        annotated(*args, config=config, **kwargs)
 
                if config_file_initialize_app:
 
                    kallithea.config.application.make_app(config.global_conf, **config.local_conf)
 
                else:
 
                    kallithea.CONFIG = dict(config)  # config is a dict subclass
 
                annotated(*args, **kwargs)
 
            return cli_command(runtime_wrapper)
 
        return annotator
kallithea/bin/kallithea_cli_extensions.py
Show inline comments
 
@@ -24,20 +24,19 @@ import os
 
import click
 
import pkg_resources
 

	
 
import kallithea
 
import kallithea.bin.kallithea_cli_base as cli_base
 
from kallithea.lib.utils2 import ask_ok
 

	
 

	
 
@cli_base.register_command(needs_config_file=True)
 
def extensions_create():
 
def extensions_create(config):
 
    """Write template file for extending Kallithea in Python.
 

	
 
    Create a template `extensions.py` file next to the ini file. Local
 
    customizations in that file will survive upgrades. The file contains
 
    instructions on how it can be customized.
 
    """
 
    here = kallithea.CONFIG['here']
 
    here = config['here']
 
    content = pkg_resources.resource_string(
 
        'kallithea', os.path.join('templates', 'py', 'extensions.py')
 
    )
kallithea/bin/kallithea_cli_iis.py
Show inline comments
 
@@ -16,7 +16,6 @@ import sys
 

	
 
import click
 

	
 
import kallithea
 
import kallithea.bin.kallithea_cli_base as cli_base
 

	
 

	
 
@@ -60,10 +59,10 @@ if __name__=='__main__':
 
@cli_base.register_command(needs_config_file=True)
 
@click.option('--virtualdir', default='/',
 
        help='The virtual folder to install into on IIS.')
 
def iis_install(virtualdir):
 
def iis_install(virtualdir, config):
 
    """Install into IIS using isapi-wsgi."""
 

	
 
    config_file_abs = kallithea.CONFIG['__file__']
 
    config_file_abs = config['__file__']
 

	
 
    try:
 
        import isapi_wsgi
0 comments (0 inline, 0 general)