source: TI12-security/trunk/NDGSecurity/python/Tests/openidaxtest/openidaxtest/config/environment.py @ 6440

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg-security/TI12-security/trunk/NDGSecurity/python/Tests/openidaxtest/openidaxtest/config/environment.py@6440
Revision 6440, 1.5 KB checked in by pjkersha, 11 years ago (diff)
  • #1088 Important fix to AuthnRedirectResponseMiddleware? to set redirect ONLY when SSL client authentication has just succeeded in the upstream middleware AuthKitSSLAuthnMiddleware. This bug was causing the browser to redirect to the wrong place following OpenID sign in in the case where the user is already logged into their provider and selects a new relying party to sign into.
    • Improvements to Provider decide page interface: leave out messages about attributes that the provider can't retrieve for the RP. Also included NDG style help icon.
Line 
1"""Pylons environment configuration"""
2import os
3
4from mako.lookup import TemplateLookup
5from pylons import config
6from pylons.error import handle_mako_error
7
8import openidaxtest.lib.app_globals as app_globals
9import openidaxtest.lib.helpers
10from openidaxtest.config.routing import make_map
11
12def load_environment(global_conf, app_conf):
13    """Configure the Pylons environment via the ``pylons.config``
14    object
15    """
16    # Pylons paths
17    root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
18    paths = dict(root=root,
19                 controllers=os.path.join(root, 'controllers'),
20                 static_files=os.path.join(root, 'public'),
21                 templates=[os.path.join(root, 'templates')])
22
23    # Initialize config with the basic options
24    config.init_app(global_conf, app_conf, package='openidaxtest', paths=paths)
25
26    config['routes.map'] = make_map()
27    config['pylons.app_globals'] = app_globals.Globals()
28    config['pylons.h'] = openidaxtest.lib.helpers
29
30    # Create the Mako TemplateLookup, with the default auto-escaping
31    config['pylons.app_globals'].mako_lookup = TemplateLookup(
32        directories=paths['templates'],
33        error_handler=handle_mako_error,
34        module_directory=os.path.join(app_conf['cache_dir'], 'templates'),
35        input_encoding='utf-8', default_filters=['escape'],
36        imports=['from webhelpers.html import escape'])
37
38    # CONFIGURATION OPTIONS HERE (note: all config options will override
39    # any Pylons config options)
Note: See TracBrowser for help on using the repository browser.