changeset 5422:33249f840ecd

config: simplify some imports
author Mads Kiilerich <madski@unity3d.com>
date Thu, 20 Aug 2015 17:29:55 +0200
parents 4f6a90fe63a1
children 42ce8e54bae5
files kallithea/config/environment.py
diffstat 1 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/config/environment.py	Thu Aug 20 17:29:55 2015 +0200
+++ b/kallithea/config/environment.py	Thu Aug 20 17:29:55 2015 +0200
@@ -20,9 +20,9 @@
 import kallithea
 import platform
 
-from mako.lookup import TemplateLookup
-from pylons.configuration import PylonsConfig
-from pylons.error import handle_mako_error
+import pylons
+import mako.lookup
+import beaker
 
 # don't remove this import it does magic for celery
 from kallithea.lib import celerypylons
@@ -49,7 +49,7 @@
     Configure the Pylons environment via the ``pylons.config``
     object
     """
-    config = PylonsConfig()
+    config = pylons.configuration.PylonsConfig()
 
     # Pylons paths
     root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
@@ -75,13 +75,12 @@
     load_rcextensions(root_path=config['here'])
 
     # Setup cache object as early as possible
-    import pylons
     pylons.cache._push_object(config['pylons.app_globals'].cache)
 
     # Create the Mako TemplateLookup, with the default auto-escaping
-    config['pylons.app_globals'].mako_lookup = TemplateLookup(
+    config['pylons.app_globals'].mako_lookup = mako.lookup.TemplateLookup(
         directories=paths['templates'],
-        error_handler=handle_mako_error,
+        error_handler=pylons.error.handle_mako_error,
         module_directory=os.path.join(app_conf['cache_dir'], 'templates'),
         input_encoding='utf-8', default_filters=['escape'],
         imports=['from webhelpers.html import escape'])