##// END OF EJS Templates
cli: only config_file_initialize_app should set global CONFIG; needs_config_file will be passed the config object
Mads Kiilerich -
r8609:e9521559 default
parent child Browse files
Show More
@@ -42,7 +42,7 b' BACKENDS = {'
42 42
43 43 CELERY_APP = None # set to Celery app instance if using Celery
44 44
45 CONFIG = {}
45 CONFIG = {} # set to tg.config when TG app is initialized and calls app_cfg
46 46
47 47 # URL prefix for non repository related links - must start with `/`
48 48 ADMIN_PREFIX = '/_admin'
@@ -76,12 +76,10 b' def register_command(needs_config_file=F'
76 76 cp.read_string(read_config(path_to_ini_file, strip_section_prefix=annotated.__name__))
77 77 logging.config.fileConfig(cp,
78 78 {'__file__': path_to_ini_file, 'here': os.path.dirname(path_to_ini_file)})
79 if config_file_initialize_app:
80 if needs_config_file: # special case for db creation: also call annotated function (with config parameter) *before* app initialization
79 if needs_config_file:
81 80 annotated(*args, config=config, **kwargs)
81 if config_file_initialize_app:
82 82 kallithea.config.application.make_app(config.global_conf, **config.local_conf)
83 else:
84 kallithea.CONFIG = dict(config) # config is a dict subclass
85 83 annotated(*args, **kwargs)
86 84 return cli_command(runtime_wrapper)
87 85 return annotator
@@ -24,20 +24,19 b' import os'
24 24 import click
25 25 import pkg_resources
26 26
27 import kallithea
28 27 import kallithea.bin.kallithea_cli_base as cli_base
29 28 from kallithea.lib.utils2 import ask_ok
30 29
31 30
32 31 @cli_base.register_command(needs_config_file=True)
33 def extensions_create():
32 def extensions_create(config):
34 33 """Write template file for extending Kallithea in Python.
35 34
36 35 Create a template `extensions.py` file next to the ini file. Local
37 36 customizations in that file will survive upgrades. The file contains
38 37 instructions on how it can be customized.
39 38 """
40 here = kallithea.CONFIG['here']
39 here = config['here']
41 40 content = pkg_resources.resource_string(
42 41 'kallithea', os.path.join('templates', 'py', 'extensions.py')
43 42 )
@@ -16,7 +16,6 b' import sys'
16 16
17 17 import click
18 18
19 import kallithea
20 19 import kallithea.bin.kallithea_cli_base as cli_base
21 20
22 21
@@ -60,10 +59,10 b" if __name__=='__main__':"
60 59 @cli_base.register_command(needs_config_file=True)
61 60 @click.option('--virtualdir', default='/',
62 61 help='The virtual folder to install into on IIS.')
63 def iis_install(virtualdir):
62 def iis_install(virtualdir, config):
64 63 """Install into IIS using isapi-wsgi."""
65 64
66 config_file_abs = kallithea.CONFIG['__file__']
65 config_file_abs = config['__file__']
67 66
68 67 try:
69 68 import isapi_wsgi
General Comments 0
You need to be logged in to leave comments. Login now