当前位置: 首页>>代码示例>>Python>>正文


Python configuration.PylonsConfig类代码示例

本文整理汇总了Python中pylons.configuration.PylonsConfig的典型用法代码示例。如果您正苦于以下问题:Python PylonsConfig类的具体用法?Python PylonsConfig怎么用?Python PylonsConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PylonsConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: load_environment

def load_environment(global_conf, app_conf):
    'Configure the Pylons environment via the ``pylons.config`` object'
    # Set paths
    root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    paths = dict(
        root=root,
        controllers=os.path.join(root, 'controllers'),
        static_files=os.path.join(root, 'public'),
        templates=[os.path.join(root, 'templates')])
    # Initialize config with the basic options
    config = PylonsConfig()
    config.init_app(global_conf, app_conf, package='jobitos', paths=paths)
    config['routes.map'] = make_map(config)
    config['pylons.app_globals'] = app_globals.Globals(config)
    config['pylons.h'] = helpers
    # 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(
        directories=paths['templates'],
        error_handler=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'])
    # Setup the SQLAlchemy database engine
    engine = engine_from_config(config, 'sqlalchemy.')
    init_model(engine)
    # Return
    return config
开发者ID:invisibleroads,项目名称:jobitos,代码行数:30,代码来源:environment.py

示例2: load_environment

def load_environment(global_conf, app_conf):
    """Configure the Pylons environment via the ``pylons.config``
    object
    """
    config = PylonsConfig()
    
    # Pylons paths
    root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    paths = dict(root=root,
                 controllers=os.path.join(root, 'controllers'),
                 static_files=os.path.join(root, 'public'),
                 templates=[os.path.join(root, 'templates')])

    # Initialize config with the basic options
    config.init_app(global_conf, app_conf, package='blog', paths=paths)

    config['routes.map'] = make_map(config)
    config['pylons.app_globals'] = app_globals.Globals(config)
    config['pylons.h'] = blog.lib.helpers
    
    # Setup cache object as early as possible
    import pylons
    pylons.cache._push_object(config['pylons.app_globals'].cache)
    

    # Create the Jinja2 Environment
    config['pylons.app_globals'].jinja2_env = Environment(loader=ChoiceLoader(
            [FileSystemLoader(path) for path in paths['templates']]))
    # Jinja2's unable to request c's attributes without strict_c
    config['pylons.strict_tmpl_context'] = True

    # CONFIGURATION OPTIONS HERE (note: all config options will override
    # any Pylons config options)
    
    return config
开发者ID:redduck666,项目名称:blog,代码行数:35,代码来源:environment.py

示例3: load_environment

def load_environment(global_conf, app_conf):
    """Configure the Pylons environment via the ``pylons.config``
    object
    """
    config = PylonsConfig()

    # Pylons paths
    root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    paths = dict(root=root,
                 controllers=os.path.join(root, 'controllers'),
                 static_files=os.path.join(root, 'public'),
                 templates=[os.path.join(root, 'templates')])

    # Initialize config with the basic options
    config.init_app(global_conf, app_conf, package='toast', paths=paths)

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

    # Setup cache object as early as possible
    import pylons
    pylons.cache._push_object(config['pylons.app_globals'].cache)


    # Create the Jinja2 Environment
    jinja2_env = Environment(loader=FileSystemLoader(paths['templates']))
    config['pylons.app_globals'].jinja2_env = jinja2_env

    # CONFIGURATION OPTIONS HERE (note: all config options will override
    # any Pylons config options)

    config['toast.application'], config['toast.database'] = build_application()

    return config
开发者ID:christianblunden,项目名称:toast,代码行数:35,代码来源:environment.py

示例4: load_environment

def load_environment(global_conf, app_conf, with_db=True):
    """Configure the Pylons environment via the ``pylons.config``
    object
    """
    # Pylons paths
    conf_copy = global_conf.copy()
    conf_copy.update(app_conf)
    site_templates = create_site_subdirectory('templates', app_conf=conf_copy)
    root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    client_containing = app_conf.get('adhocracy.client_location')
    if client_containing:
        client_root = os.path.join(client_containing, 'adhocracy_client')
        sys.path.insert(0, client_containing)
        import adhocracy_client.static
        sys.modules['adhocracy.static'] = adhocracy_client.static
    else:
        client_root = root
    import adhocracy.static
    paths = dict(root=root,
                 controllers=os.path.join(root, 'controllers'),
                 static_files=os.path.join(client_root, 'static'),
                 templates=[site_templates,
                            os.path.join(client_root, 'templates')])

    # Initialize config with the basic options
    config = PylonsConfig()

    config.init_app(global_conf, app_conf, package='adhocracy', paths=paths)

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

    # Create the Mako TemplateLookup, with the default auto-escaping
    config['pylons.app_globals'].mako_lookup = TemplateLookup(
        directories=paths['templates'],
        error_handler=handle_mako_error,
        module_directory=os.path.join(app_conf['cache_dir'], 'templates'),
        input_encoding='utf-8', default_filters=['escape'],
        imports=['from markupsafe import escape'])

    config['pylons.strict_tmpl_context'] = False

    # Setup the SQLAlchemy database engine
    engineOpts = {}
    if asbool(config.get('adhocracy.debug.sql', False)):
        engineOpts['connectionproxy'] = TimerProxy()

    engine = engine_from_config(config, 'sqlalchemy.', **engineOpts)
    init_model(engine)

    # CONFIGURATION OPTIONS HERE (note: all config options will override
    # any Pylons config options)
    init_site(config)
    if with_db:
        init_search()
    init_democracy()
    RQConfig.setup_from_config(config)

    return config
开发者ID:dwt,项目名称:adhocracy,代码行数:60,代码来源:environment.py

示例5: load_environment

def load_environment(global_conf, app_conf):
    """Configure the Pylons environment via the ``pylons.config``
    object
    """
    config = PylonsConfig()

    # Pylons paths
    root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    paths = dict(root=root,
                 controllers=os.path.join(root, 'controllers'),
                 static_files=os.path.join(root, 'public'),
                 templates=[os.path.join(root, 'templates')])

    # Initialize config with the basic options
    config.init_app(global_conf, app_conf, package='sssweb', paths=paths)

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

    # Create the Mako TemplateLookup, with the default auto-escaping
    config['pylons.app_globals'].mako_lookup = TemplateLookup(
        directories=paths['templates'],
        error_handler=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'])

    # CONFIGURATION OPTIONS HERE (note: all config options will override
    # any Pylons config options)

    # Setup the SQLAlchemy database engine
    engine = engine_from_config(config, 'sqlalchemy.')
    init_model(engine)
    return config
开发者ID:marta09,项目名称:szarp,代码行数:35,代码来源:environment.py

示例6: load_environment

def load_environment(global_conf, app_conf):
    """Configure the Pylons environment for SIS."""
    config = PylonsConfig()

    # Pylons paths
    root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    paths = dict(root=root,
                 controllers=os.path.join(root, 'controllers'),
                 static_files=os.path.join(root, 'public'),
                 templates=[os.path.join(root, 'templates')])

    # Initialize config with the basic options
    config.init_app(global_conf, app_conf, package='sis', paths=paths)

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

    # Setup cache object as early as possible
    import pylons
    pylons.cache._push_object(config['pylons.app_globals'].cache)

    # Create the Genshi TemplateLoader
    config['pylons.app_globals'].genshi_loader = TemplateLoader(
        paths['templates'], auto_reload=True)

    # Setup the SQLAlchemy database engine
    engine = engine_from_config(config, 'sqlalchemy.')
    init_model(engine)

    # CONFIGURATION OPTIONS HERE (note: all config options will override
    # any Pylons config options)

    return config
开发者ID:kuba,项目名称:SIS,代码行数:34,代码来源:environment.py

示例7: load_environment

def load_environment(global_conf, app_conf):
    """Configure the Pylons environment via the ``pylons.config`` object"""

    config = PylonsConfig()

    # Pylons paths
    root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    paths = dict(root=root,
                 controllers=os.path.join(root, "controllers"),
                 static_files=os.path.join(root, "public"),
                 templates=[os.path.join(root, "templates")])

    # Initialize config with the basic options
    config.init_app(global_conf, app_conf, package="harstorage", paths=paths)

    config["routes.map"] = make_map(config)
    config["pylons.app_globals"] = app_globals.Globals(config)
    config["pylons.h"] = harstorage.lib.helpers

    # 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(
        directories=paths["templates"],
        error_handler=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"])

    return config
开发者ID:AutomationConsultant,项目名称:harstorage,代码行数:33,代码来源:environment.py

示例8: load_environment

def load_environment(global_conf, app_conf):
    """Configure the Pylons environment via the ``pylons.config``
    object
    """
    config = PylonsConfig()
    
    # Pylons paths
    root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    paths = dict(root=root,
                 controllers=os.path.join(root, 'controllers'),
                 static_files=os.path.join(root, 'public'),
                 templates=[os.path.join(root, 'templates')])

    # import our private.ini that holds keys, etc
    imp = global_conf.get('import')
    if imp:
        cp = ConfigParser()
        cp.read(imp)
        global_conf.update(cp.defaults())
        if cp.has_section('APP'):
            app_conf.update(cp.items('APP'))

    # Initialize config with the basic options
    config.init_app(global_conf, app_conf, package='linkdrop', paths=paths)
    config['routes.map'] = make_map(config)
    config['pylons.app_globals'] = app_globals.Globals(config)

    import linkdrop.lib.helpers as h
    config['pylons.h'] = h
    
    # 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(
        directories=paths['templates'],
        error_handler=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'])

    # Setup the SQLAlchemy database engine
    engine = engine_from_config(config, 'sqlalchemy.')
    init_model(engine)

    # sqlalchemy auto migration
    if asbool(config.get('migrate.auto')):
        try:
            # managed upgrades
            cschema = schema.ControlledSchema.create(engine, config['migrate.repository'])
            cschema.update_db_from_model(meta.Base.metadata)
        except exceptions.InvalidRepositoryError, e:
            # unmanaged upgrades
            diff = schemadiff.getDiffOfModelAgainstDatabase(
                meta.Base.metadata, engine, excludeTables=None)
            genmodel.ModelGenerator(diff).applyModel()
开发者ID:LeonardoXavier,项目名称:f1,代码行数:57,代码来源:environment.py

示例9: load_environment

def load_environment( global_conf, app_conf ):
	"""Configure the Pylons environment via the ``pylons.config`` object """

	config = PylonsConfig()
	
	# Pylons paths
	root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
	paths = dict(root=root,
			controllers=os.path.join(root, 'controllers'),
			static_files=os.path.join(root, 'public'),
			templates=[os.path.join(root, 'templates')])

	# Initialize config with the basic options
	config.init_app( global_conf, app_conf, package='sparta', paths=paths )    

	config['routes.map'] = make_map(config)
	config['pylons.app_globals'] = app_globals.Globals(config)	  
	config["pylons.strict_tmpl_context"] = False	# 중요한 셋업, 젠씨에서 ContextOBJ에 데이터가 없을때 공백으로 대체시킴

	# Setup cache object as early as possible
	import pylons
	pylons.cache._push_object( config['pylons.app_globals'].cache )
	

	# Create the Genshi TemplateLoader
	config['pylons.app_globals'].genshi_loader = TemplateLoader( paths['templates'], auto_reload=True )


	# Setup the SQLAlchemy database engine
	engine = engine_from_config(config, 'sqlalchemy.')
	init_model( engine )

	# CONFIGURATION OPTIONS HERE (note: all config options will override any Pylons config options)
	
	#try:
	preCachingTables()	# 테이블 캐슁	  
	#except Exception as err:
	#	 print err
	
	# 아키텍쳐 셋팅
	init_architect()
	
	# DB에 저장된 설정정보 가져옴
	try:		
		init_configset()
	except Exception as err:
		pass
		#print err
	
	#try:
	plugins.init_plugins()		 # 플러그인 셋팅		
	#except Exception as err:
	#	 print err
	
	log.debug("DONE: load_environment ")
	return config
开发者ID:onetera,项目名称:sp,代码行数:56,代码来源:environment.py

示例10: load_environment

def load_environment(global_conf, app_conf, initial=False):
    """Configure the Pylons environment via the ``pylons.config``
    object
    """
    config = PylonsConfig()

    # Pylons paths
    root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    paths = dict(root=root,
                 controllers=os.path.join(root, 'controllers'),
                 static_files=os.path.join(root, 'public'),
                 templates=[os.path.join(root, 'templates')])

    # Initialize config with the basic options
    config.init_app(global_conf, app_conf, package='rhodecode', paths=paths)

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

    # 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(
        directories=paths['templates'],
        error_handler=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'])

    #sets the c attribute access when don't existing attribute are accessed
    config['pylons.strict_tmpl_context'] = True
    test = os.path.split(config['__file__'])[-1] == 'test.ini'
    if test:
        from rhodecode.lib.utils import create_test_env, create_test_index
        from rhodecode.tests import  TESTS_TMP_PATH
        create_test_env(TESTS_TMP_PATH, config)
        create_test_index(TESTS_TMP_PATH, config, True)

    #MULTIPLE DB configs
    # Setup the SQLAlchemy database engine
    sa_engine_db1 = engine_from_config(config, 'sqlalchemy.db1.')

    init_model(sa_engine_db1)

    repos_path = make_ui('db').configitems('paths')[0][1]
    repo2db_mapper(ScmModel().repo_scan(repos_path))
    set_available_permissions(config)
    config['base_path'] = repos_path
    set_rhodecode_config(config)
    # CONFIGURATION OPTIONS HERE (note: all config options will override
    # any Pylons config options)

    return config
开发者ID:lmamsen,项目名称:rhodecode,代码行数:56,代码来源:environment.py

示例11: load_environment

def load_environment(global_conf, app_conf):
    """Configure the Pylons environment via the ``pylons.config``
    object
    """
    config = PylonsConfig()

    # Pylons paths
    root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    paths = dict(root=root,
                 controllers=os.path.join(root, 'controllers'),
                 static_files=os.path.join(root, 'public'),
                 templates=[os.path.join(root, 'templates')])

    # Initialize config with the basic options
    config.init_app(global_conf, app_conf, package='agent', paths=paths)

    config['routes.map'] = make_map(config)
    config['pylons.app_globals'] = app_globals.Globals(config)

    # 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(
        directories=paths['templates'],
        error_handler=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'])

    # CONFIGURATION OPTIONS HERE (note: all config options will override
    # any Pylons config options)
    pylons.config.update(config)

    # create the base directory for the agent
    path = os.path.join(config['agent_root'], 'service_nodes')
    if not os.path.exists(path):
        os.makedirs(path)

    path = os.path.join(config['agent_root'], 'packages')
    if not os.path.exists(path):
        os.makedirs(path)

    # create directories for distribution client
    # If repo_root is not specified, assume it is same as agent_root
    if config['repo_root'] is None or config['repo_root'] == '':
        config['repo_root'] = config['agent_root']
    path = config['repo_root']
    if not os.path.exists(path):
        os.makedirs(path)

    # start the agent globals
    startAgentGlobals()

    return config
开发者ID:cronuspaas,项目名称:cronusagent,代码行数:56,代码来源:environment.py

示例12: load_environment

def load_environment(global_conf, app_conf):
    """Configure the Pylons environment via the ``pylons.config``
    object
    """
    config = PylonsConfig()

    # Pylons paths
    root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    # setup themes
    template_paths = [os.path.join(root, 'templates')]
    themesbase = app_conf.get('baruwa.themes.base', None)
    if themesbase and os.path.isabs(themesbase):
        templatedir = os.path.join(themesbase, 'templates')
        if os.path.isdir(templatedir):
            template_paths.append(templatedir)
    paths = dict(root=root,
                 controllers=os.path.join(root, 'controllers'),
                 static_files=os.path.join(root, 'public'),
                 templates=template_paths)

    # Initialize config with the basic options
    config.init_app(global_conf, app_conf, package='baruwa', paths=paths)

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

    # 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(
        directories=paths['templates'],
        error_handler=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'])

    # Setup the SQLAlchemy database engine
    surl = config['sqlalchemy.url']
    if surl.startswith('mysql'):
        conv = conversions.copy()
        conv[246] = float
        engine = create_engine(surl, pool_recycle=1800,
                    connect_args=dict(conv=conv))
    else:
        engine = engine_from_config(config, 'sqlalchemy.', poolclass=NullPool)
    init_model(engine)

    # CONFIGURATION OPTIONS HERE (note: all config options will override
    # any Pylons config options)

    return config
开发者ID:baruwaproject,项目名称:baruwa2,代码行数:54,代码来源:environment.py

示例13: load_environment

def load_environment(global_conf, app_conf):
    """Configure the Pylons environment via the ``pylons.config``
    object
    """
    config = PylonsConfig()
    
    # Pylons paths
    root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    paths = dict(root=root,
                 controllers=os.path.join(root, 'controllers'),
                 static_files=os.path.join(root, 'public'),
                 templates=[os.path.join(root, 'templates')])

    # Initialize config with the basic options
    config.init_app(global_conf, app_conf, package='tedx', paths=paths)

    config['routes.map'] = make_map(config)
    config['pylons.app_globals'] = app_globals.Globals(config)
    config['pylons.h'] = tedx.lib.helpers
    
    # Setup cache object as early as possible
    import pylons
    pylons.cache._push_object(config['pylons.app_globals'].cache)
    
    def my_preprocessor(text):
        text = re.sub(r'<(/?)mako:', r"<\1%", text)
        ##
        return text

    # Create the Mako TemplateLookup, with the default auto-escaping
    config['pylons.app_globals'].mako_lookup = TemplateLookup(
        directories=paths['templates'],
        error_handler=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'],
        preprocessor=my_preprocessor)
    
    config['pylons.strict_tmpl_context'] = False

    # Setup the SQLAlchemy database engine
    engine = engine_from_config(config, 'sqlalchemy.')
    init_model(engine)

    # CONFIGURATION OPTIONS HERE (note: all config options will override
    # any Pylons config options)
    
        
    #MIMETypes for video
    #MIMETypes.init()
    #MIMETypes.add_alias('mp4', 'video/mpeg')
    #MIMETypes.add_alias('flv', 'video/x-flv')
    
    return config
开发者ID:Ibercivis,项目名称:Feelicity,代码行数:54,代码来源:environment.py

示例14: load_environment

def load_environment(global_conf, app_conf):
    """Configure the Pylons environment via the ``pylons.config`` object"""
    config = PylonsConfig()

    # Pylons paths
    root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    paths = dict(
        root=root,
        controllers=os.path.join(root, "controllers"),
        static_files=os.path.join(root, "public"),
        templates=[os.path.join(root, "templates")],
    )

    # Initialize config with the basic options
    config.init_app(global_conf, app_conf, package="ocsmanager", paths=paths)

    config["routes.map"] = make_map(config)
    config["pylons.app_globals"] = app_globals.Globals(config)
    config["pylons.h"] = ocsmanager.lib.helpers

    # 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(
        directories=paths["templates"],
        error_handler=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"],
    )

    # CONFIGURATION OPTIONS HERE (note: all config options will override
    # any Pylons config options)
    ocsconfig = OCSConfig.OCSConfig(global_conf["__file__"])
    config["ocsmanager"] = ocsconfig.load()

    config["samba"] = _load_samba_environment()
    config["ocdb"] = get_openchangedb(config["samba"]["samdb_ldb"].lp)

    mapistore.set_mapping_path(config["ocsmanager"]["main"]["mapistore_data"])
    mstore = mapistore.MAPIStore(config["ocsmanager"]["main"]["mapistore_root"])
    config["mapistore"] = mstore
    config["management"] = mstore.management()
    if config["ocsmanager"]["main"]["debug"] == "yes":
        config["management"].verbose = True

    return config
开发者ID:kamenim,项目名称:openchange,代码行数:51,代码来源:environment.py

示例15: load_environment

def load_environment(global_conf, app_conf):
    """Configure the Pylons environment via the ``pylons.config``
    object
    """
    config = PylonsConfig()

    # Pylons paths
    root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    paths = dict(root=root,
                 controllers=os.path.join(root, 'controllers'),
                 static_files=os.path.join(root, 'public'),
                 templates=[os.path.join(root, 'templates')])

    # Initialize config with the basic options
    config.init_app(global_conf, app_conf, package='converter.web', paths=paths)

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

    # 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(
        directories=paths['templates'],
        error_handler=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'])

    # CONFIGURATION OPTIONS HERE (note: all config options will override
    # any Pylons config options)

    # Configure logging from input paster config file.  This is
    # normally configured by paster serve but we do not use it.
    _configureLogging(global_conf['__file__'])

    log.info('Creating server instance.')

    if config['converter.start_server'] == 'true':
       s = server.CreateServer(config)
       config['converter._server'] = s
       config['converter.client'] = Client(s)

       s.Start()

    return config
开发者ID:4v4t4r,项目名称:thinapp_factory,代码行数:50,代码来源:environment.py


注:本文中的pylons.configuration.PylonsConfig类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。