##// END OF EJS Templates
fix(tests): added ability for test to get an up-to-date version mercurial.
fix(tests): added ability for test to get an up-to-date version mercurial.

File last commit:

r5608:6d33e504 default
r5653:11c8ab5c tip default
Show More
environment.py
100 lines | 3.7 KiB | text/x-python | PythonLexer
core: updated copyright to 2024
r5608 # Copyright (C) 2010-2024 RhodeCode GmbH
project: added all source files and assets
r1 #
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License, version 3
# (only), as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# This program is dual-licensed. If you wish to learn more about the
# RhodeCode Enterprise Edition, including its added features, Support services,
# and proprietary license terms, please see https://rhodecode.com/licenses/
import logging
fix(vcs-operations): fixed problems with locked repos and with branch permissions reporting, previously it shown error 500 when those cases were handled
r5541
project: added all source files and assets
r1 import rhodecode
python3: fixed various code issues...
r4973 import collections
project: added all source files and assets
r1
from rhodecode.config import utils
pylons: remove pylons as dependency...
r2351 from rhodecode.lib.utils import load_rcextensions
from rhodecode.lib.utils2 import str2bool
env: removed old not used code for starting vcsserver together with rhodecode.
r2458 from rhodecode.lib.vcs import connect_vcs
project: added all source files and assets
r1
log = logging.getLogger(__name__)
core: code refactor and cleanups for easier pylons porting.
r2321
tests: fixed test suite for celery adoption
r5607 def propagate_rhodecode_config(global_config, settings, config, full=True):
feat(artifacts): new artifact storage engines allowing an s3 based uploads
r5516 # Store the settings to make them available to other modules.
settings_merged = global_config.copy()
settings_merged.update(settings)
if config:
settings_merged.update(config)
rhodecode.PYRAMID_SETTINGS = settings_merged
rhodecode.CONFIG = settings_merged
tests: fixed test suite for celery adoption
r5607 if full and 'default_user_id' not in rhodecode.CONFIG:
feat(artifacts): new artifact storage engines allowing an s3 based uploads
r5516 rhodecode.CONFIG['default_user_id'] = utils.get_default_user_id()
log.debug('set rhodecode.CONFIG data')
db: Move db setup code to seperate function.
r121 def load_pyramid_environment(global_config, settings):
# Some parts of the code expect a merge of global and app settings.
settings_merged = global_config.copy()
settings_merged.update(settings)
pylons: remove pylons as dependency...
r2351 # TODO(marcink): probably not required anymore
# configure channelstream,
settings_merged['channelstream_config'] = {
'enabled': str2bool(settings_merged.get('channelstream.enabled', False)),
'server': settings_merged.get('channelstream.server'),
'secret': settings_merged.get('channelstream.secret')
}
db: Move db setup code to seperate function.
r121 # If this is a test run we prepare the test environment like
# creating a test database, test search index and test repositories.
# This has to be done before the database connection is initialized.
Updated with a latest changes.
r5357 if rhodecode.is_test:
dan
tests: disable pretty error page handler for tests, with option to...
r735 rhodecode.disable_error_handler = True
caches: enable cache TTL=30s for auth-plugins....
r2954 from rhodecode import authentication
authentication.plugin_default_auth_ttl = 0
dan
tests: disable pretty error page handler for tests, with option to...
r735
db: Move db setup code to seperate function.
r121 utils.initialize_test_environment(settings_merged)
# Initialize the database connection.
utils.initialize_database(settings_merged)
Martin Bornhold
vcs: Move the setup code for vcs lib from pylons to pyramid layer....
r582
pylons: remove pylons as dependency...
r2351 load_rcextensions(root_path=settings_merged['here'])
repositories: preserve order of defined backends, and switched repo type selector to radios.
r4321 # Limit backends to `vcs.backends` from configuration, and preserve the order
fix(backend): fixed broken backends function after python3 migration...
r5524 for alias in list(rhodecode.BACKENDS.keys()):
Martin Bornhold
vcs: Move the setup code for vcs lib from pylons to pyramid layer....
r582 if alias not in settings['vcs.backends']:
del rhodecode.BACKENDS[alias]
repositories: preserve order of defined backends, and switched repo type selector to radios.
r4321
app: use simpler way to extract default_user_id, this will be now registered at server...
r4332 _sorted_backend = sorted(rhodecode.BACKENDS.items(),
key=lambda item: settings['vcs.backends'].index(item[0]))
python3: fixed various code issues...
r4973 rhodecode.BACKENDS = collections.OrderedDict(_sorted_backend)
repositories: preserve order of defined backends, and switched repo type selector to radios.
r4321
fix(backend): fixed broken backends function after python3 migration...
r5524 log.info('Enabled VCS backends: %s', list(rhodecode.BACKENDS.keys()))
Martin Bornhold
vcs: Move the setup code for vcs lib from pylons to pyramid layer....
r582
# initialize vcs client and optionally run the server if enabled
vcs_server_uri = settings['vcs.server']
vcs_server_enabled = settings['vcs.server.enable']
utils.configure_vcs(settings)
users: ported controllers from pylons into pyramid views.
r2114
feat(artifacts): new artifact storage engines allowing an s3 based uploads
r5516 # first run, to store data...
propagate_rhodecode_config(global_config, settings, {})
pylons: remove pylons as dependency...
r2351
tests: fixed test suite for celery adoption
r5607
Martin Bornhold
vcs: Move the setup code for vcs lib from pylons to pyramid layer....
r582 if vcs_server_enabled:
connect_vcs(vcs_server_uri, utils.get_vcs_server_protocol(settings))
vcs: report warning on start if vcsserver connection is not configured
r4955 else:
log.warning('vcs-server not enabled, vcs connection unavailable')