# HG changeset patch # User Marcin Kuzminski # Date 2017-11-07 23:13:27 # Node ID a29db630fdc777abb60145200a2f5aa91b456f40 # Parent 5f5b793d78646c3537bde4ccb4c1a5b248ac8ae6 core: code refactor and cleanups for easier pylons porting. diff --git a/rhodecode/config/environment.py b/rhodecode/config/environment.py --- a/rhodecode/config/environment.py +++ b/rhodecode/config/environment.py @@ -25,13 +25,8 @@ Pylons environment configuration import os import logging import rhodecode -import platform -import re -import io from mako.lookup import TemplateLookup -from pylons.configuration import PylonsConfig -from pylons.error import handle_mako_error from pyramid.settings import asbool # ------------------------------------------------------------------------------ @@ -46,25 +41,25 @@ import rhodecode.integrations from rhodecode.lib import app_globals from rhodecode.config import utils from rhodecode.config.routing import make_map -from rhodecode.config.jsroutes import generate_jsroutes_content from rhodecode.lib import helpers -from rhodecode.lib.auth import set_available_permissions from rhodecode.lib.utils import ( - repo2db_mapper, make_db_config, set_rhodecode_config, - load_rcextensions) + make_db_config, set_rhodecode_config, load_rcextensions) from rhodecode.lib.utils2 import str2bool, aslist from rhodecode.lib.vcs import connect_vcs, start_vcs_server -from rhodecode.model.scm import ScmModel log = logging.getLogger(__name__) + def load_environment(global_conf, app_conf, initial=False, test_env=None, test_index=None): """ Configure the Pylons environment via the ``pylons.config`` object """ + from pylons.configuration import PylonsConfig + from pylons.error import handle_mako_error + config = PylonsConfig() diff --git a/rhodecode/config/middleware.py b/rhodecode/config/middleware.py --- a/rhodecode/config/middleware.py +++ b/rhodecode/config/middleware.py @@ -23,11 +23,10 @@ Pylons middleware initialization """ import logging import traceback -from collections import OrderedDict +import collections from paste.registry import RegistryManager from paste.gzipper import make_gzip_middleware -from pylons.wsgiapp import PylonsApp from pyramid.authorization import ACLAuthorizationPolicy from pyramid.config import Configurator from pyramid.settings import asbool, aslist @@ -101,6 +100,8 @@ def make_app(global_conf, static_files=T defaults to main). """ + from pylons.wsgiapp import PylonsApp + # Apply compatibility patches patches.kombu_1_5_1_python_2_7_11() patches.inspect_getargspec() @@ -267,7 +268,7 @@ def includeme(config): settings = config.registry.settings # plugin information - config.registry.rhodecode_plugins = OrderedDict() + config.registry.rhodecode_plugins = collections.OrderedDict() config.add_directive( 'register_rhodecode_plugin', register_rhodecode_plugin)