##// END OF EJS Templates
mercurial middleware now returns 500's instead of 404 on errors and 404 when repo not found, added tracebacks
mercurial middleware now returns 500's instead of 404 on errors and 404 when repo not found, added tracebacks

File last commit:

r309:7e4771a0 default
r334:6c23e724 default
Show More
environment.py
70 lines | 2.7 KiB | text/x-python | PythonLexer
Marcin Kuzminski
initial commit.
r0 """Pylons environment configuration"""
from mako.lookup import TemplateLookup
changed for pylons 0.1 / 1.0...
r43 from pylons.configuration import PylonsConfig
Marcin Kuzminski
initial commit.
r0 from pylons.error import handle_mako_error
Adde draft for permissions systems, made all needed decorators, and checks. For future usage in the system.
r239 from pylons_app.config.routing import make_map
added base path into config
r309 from pylons_app.lib.auth import set_available_permissions, set_base_path
licensing updates, code cleanups
r252 from pylons_app.lib.utils import repo2db_mapper
Adde draft for permissions systems, made all needed decorators, and checks. For future usage in the system.
r239 from pylons_app.model import init_model
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
r265 from pylons_app.model.hg_model import _get_repos_cached_initial
changed for pylons 0.1 / 1.0...
r43 from sqlalchemy import engine_from_config
Adde draft for permissions systems, made all needed decorators, and checks. For future usage in the system.
r239 import logging
import os
Marcin Kuzminski
initial commit.
r0 import pylons_app.lib.app_globals as app_globals
import pylons_app.lib.helpers
Adde draft for permissions systems, made all needed decorators, and checks. For future usage in the system.
r239
Marcin Kuzminski
initial commit.
r0 log = logging.getLogger(__name__)
def load_environment(global_conf, app_conf):
"""Configure the Pylons environment via the ``pylons.config``
object
"""
changed for pylons 0.1 / 1.0...
r43 config = PylonsConfig()
Marcin Kuzminski
initial commit.
r0 # Pylons paths
root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
Marcin Kuzminski
dirty fix for multiple file encodings,
r32 paths = dict(root=root,
controllers=os.path.join(root, 'controllers'),
static_files=os.path.join(root, 'public'),
templates=[os.path.join(root, 'templates')])
Marcin Kuzminski
initial commit.
r0
# Initialize config with the basic options
changed for pylons 0.1 / 1.0...
r43 config.init_app(global_conf, app_conf, package='pylons_app', paths=paths)
Marcin Kuzminski
initial commit.
r0
changed for pylons 0.1 / 1.0...
r43 config['routes.map'] = make_map(config)
config['pylons.app_globals'] = app_globals.Globals(config)
Marcin Kuzminski
initial commit.
r0 config['pylons.h'] = pylons_app.lib.helpers
changed for pylons 0.1 / 1.0...
r43
# Setup cache object as early as possible
import pylons
pylons.cache._push_object(config['pylons.app_globals'].cache)
Marcin Kuzminski
initial commit.
r0 # Create the Mako TemplateLookup, with the default auto-escaping
Marcin Kuzminski
Added app basic auth....
r41 config['pylons.app_globals'].mako_lookup = TemplateLookup(
Marcin Kuzminski
dirty fix for multiple file encodings,
r32 directories=paths['templates'],
error_handler=handle_mako_error,
module_directory=os.path.join(app_conf['cache_dir'], 'templates'),
Marcin Kuzminski
Added app basic auth....
r41 input_encoding='utf-8', default_filters=['escape'],
imports=['from webhelpers.html import escape'])
Marcin Kuzminski
initial commit.
r0
licensing updates, code cleanups
r252 #sets the c attribute access when don't existing attribute are accessed
Added repo switcher, in base and long term caching for this.
r107 config['pylons.strict_tmpl_context'] = True
changed for pylons 0.1 / 1.0...
r43
#MULTIPLE DB configs
# Setup the SQLAlchemy database engine
Marcin Kuzminski
Added sqlalchemy support...
r49 if config['debug']:
#use query time debugging.
from pylons_app.lib.timerproxy import TimerProxy
sa_engine_db1 = engine_from_config(config, 'sqlalchemy.db1.',
proxy=TimerProxy())
else:
sa_engine_db1 = engine_from_config(config, 'sqlalchemy.db1.')
changed for pylons 0.1 / 1.0...
r43
Marcin Kuzminski
Added sqlalchemy support...
r49 init_model(sa_engine_db1)
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
r265 repo2db_mapper(_get_repos_cached_initial(config['pylons.app_globals']))
Adde draft for permissions systems, made all needed decorators, and checks. For future usage in the system.
r239 set_available_permissions(config)
added base path into config
r309 set_base_path(config)
Marcin Kuzminski
initial commit.
r0 # CONFIGURATION OPTIONS HERE (note: all config options will override
# any Pylons config options)
changed for pylons 0.1 / 1.0...
r43
return config