Mercurial > kallithea
comparison rhodecode/config/environment.py @ 4116:ffd45b185016 rhodecode-2.2.5-gpl
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
This imports changes between changesets 21af6c4eab3d and 6177597791c2 in
RhodeCode's original repository, including only changes to Python files and HTML.
RhodeCode clearly licensed its changes to these files under GPLv3
in their /LICENSE file, which states the following:
The Python code and integrated HTML are licensed under the GPLv3 license.
(See:
https://code.rhodecode.com/rhodecode/files/v2.2.5/LICENSE
or
http://web.archive.org/web/20140512193334/https://code.rhodecode.com/rhodecode/files/f3b123159901f15426d18e3dc395e8369f70ebe0/LICENSE
for an online copy of that LICENSE file)
Conservancy reviewed these changes and confirmed that they can be licensed as
a whole to the Kallithea project under GPLv3-only.
While some of the contents committed herein are clearly licensed
GPLv3-or-later, on the whole we must assume the are GPLv3-only, since the
statement above from RhodeCode indicates that they intend GPLv3-only as their
license, per GPLv3ยง14 and other relevant sections of GPLv3.
author | Bradley M. Kuhn <bkuhn@sfconservancy.org> |
---|---|
date | Wed, 02 Jul 2014 19:03:13 -0400 |
parents | 5293d4bbb1ea |
children | 7e5f8c12a3fc |
comparison
equal
deleted
inserted
replaced
4115:8b7294a804a0 | 4116:ffd45b185016 |
---|---|
1 """Pylons environment configuration""" | 1 # -*- coding: utf-8 -*- |
2 # This program is free software: you can redistribute it and/or modify | |
3 # it under the terms of the GNU General Public License as published by | |
4 # the Free Software Foundation, either version 3 of the License, or | |
5 # (at your option) any later version. | |
6 # | |
7 # This program is distributed in the hope that it will be useful, | |
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
10 # GNU General Public License for more details. | |
11 # | |
12 # You should have received a copy of the GNU General Public License | |
13 # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
14 """ | |
15 Pylons environment configuration | |
16 """ | |
2 | 17 |
3 import os | 18 import os |
4 import logging | 19 import logging |
5 import rhodecode | 20 import rhodecode |
21 import platform | |
6 | 22 |
7 from mako.lookup import TemplateLookup | 23 from mako.lookup import TemplateLookup |
8 from pylons.configuration import PylonsConfig | 24 from pylons.configuration import PylonsConfig |
9 from pylons.error import handle_mako_error | 25 from pylons.error import handle_mako_error |
10 | 26 |
25 from rhodecode.model.scm import ScmModel | 41 from rhodecode.model.scm import ScmModel |
26 | 42 |
27 log = logging.getLogger(__name__) | 43 log = logging.getLogger(__name__) |
28 | 44 |
29 | 45 |
30 def load_environment(global_conf, app_conf, initial=False): | 46 def load_environment(global_conf, app_conf, initial=False, |
47 test_env=None, test_index=None): | |
31 """ | 48 """ |
32 Configure the Pylons environment via the ``pylons.config`` | 49 Configure the Pylons environment via the ``pylons.config`` |
33 object | 50 object |
34 """ | 51 """ |
35 config = PylonsConfig() | 52 config = PylonsConfig() |
71 | 88 |
72 # sets the c attribute access when don't existing attribute are accessed | 89 # sets the c attribute access when don't existing attribute are accessed |
73 config['pylons.strict_tmpl_context'] = True | 90 config['pylons.strict_tmpl_context'] = True |
74 test = os.path.split(config['__file__'])[-1] == 'test.ini' | 91 test = os.path.split(config['__file__'])[-1] == 'test.ini' |
75 if test: | 92 if test: |
93 if test_env is None: | |
94 test_env = not int(os.environ.get('RC_NO_TMP_PATH', 0)) | |
95 if test_index is None: | |
96 test_index = not int(os.environ.get('RC_WHOOSH_TEST_DISABLE', 0)) | |
76 if os.environ.get('TEST_DB'): | 97 if os.environ.get('TEST_DB'): |
77 # swap config if we pass enviroment variable | 98 # swap config if we pass enviroment variable |
78 config['sqlalchemy.db1.url'] = os.environ.get('TEST_DB') | 99 config['sqlalchemy.db1.url'] = os.environ.get('TEST_DB') |
79 | 100 |
80 from rhodecode.lib.utils import create_test_env, create_test_index | 101 from rhodecode.lib.utils import create_test_env, create_test_index |
81 from rhodecode.tests import TESTS_TMP_PATH | 102 from rhodecode.tests import TESTS_TMP_PATH |
82 # set RC_NO_TMP_PATH=1 to disable re-creating the database and | 103 #set RC_NO_TMP_PATH=1 to disable re-creating the database and |
83 # test repos | 104 #test repos |
84 if not int(os.environ.get('RC_NO_TMP_PATH', 0)): | 105 if test_env: |
85 create_test_env(TESTS_TMP_PATH, config) | 106 create_test_env(TESTS_TMP_PATH, config) |
86 # set RC_WHOOSH_TEST_DISABLE=1 to disable whoosh index during tests | 107 #set RC_WHOOSH_TEST_DISABLE=1 to disable whoosh index during tests |
87 if not int(os.environ.get('RC_WHOOSH_TEST_DISABLE', 0)): | 108 if test_index: |
88 create_test_index(TESTS_TMP_PATH, config, True) | 109 create_test_index(TESTS_TMP_PATH, config, True) |
89 | 110 |
90 DbManage.check_waitress() | 111 DbManage.check_waitress() |
91 # MULTIPLE DB configs | 112 # MULTIPLE DB configs |
92 # Setup the SQLAlchemy database engine | 113 # Setup the SQLAlchemy database engine |
98 config['base_path'] = repos_path | 119 config['base_path'] = repos_path |
99 set_rhodecode_config(config) | 120 set_rhodecode_config(config) |
100 | 121 |
101 instance_id = rhodecode.CONFIG.get('instance_id') | 122 instance_id = rhodecode.CONFIG.get('instance_id') |
102 if instance_id == '*': | 123 if instance_id == '*': |
103 instance_id = '%s-%s' % (os.uname()[1], os.getpid()) | 124 instance_id = '%s-%s' % (platform.uname()[1], os.getpid()) |
104 rhodecode.CONFIG['instance_id'] = instance_id | 125 rhodecode.CONFIG['instance_id'] = instance_id |
105 | 126 |
106 # CONFIGURATION OPTIONS HERE (note: all config options will override | 127 # CONFIGURATION OPTIONS HERE (note: all config options will override |
107 # any Pylons config options) | 128 # any Pylons config options) |
108 | 129 |