Exemplo n.º 1
0
def load_environment( global_conf, app_conf ):
    """Configure the Pylons environment via the ``pylons.config``
    object
    """
    # Pylons paths
    root = os.path.dirname( os.path.dirname( os.path.abspath( __file__ ) ) )
    diracConfig = initDIRAC( root, global_conf[ 'debug' ] )
    paths = dict( root = root,
                  controllers = diracConfig[ 'controllers' ],
                  static_files = diracConfig[ 'public' ],
                  templates = diracConfig[ 'templates' ] )

    # Initialize config with the basic options
    config.init_app( global_conf, app_conf, package = 'dirac',
                    template_engine = 'mako', paths = paths )
    #Add dirac configs
    for k in diracConfig[ 'webConfig' ]:
      config[ k ] = diracConfig[ 'webConfig' ][ k ]


    config['routes.map'] = make_map()
    config['pylons.g'] = app_globals.Globals()
    config['pylons.h'] = dirac.lib.helpers

    # Customize templating options via this variable
    tmpl_options = config['buffet.template_options']
    config['version'] = diracConfig['portalVersion']