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


Python AppConfig.variable_provider方法代码示例

本文整理汇总了Python中tg.configuration.AppConfig.variable_provider方法的典型用法代码示例。如果您正苦于以下问题:Python AppConfig.variable_provider方法的具体用法?Python AppConfig.variable_provider怎么用?Python AppConfig.variable_provider使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tg.configuration.AppConfig的用法示例。


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

示例1: AppConfig

# 需要导入模块: from tg.configuration import AppConfig [as 别名]
# 或者: from tg.configuration.AppConfig import variable_provider [as 别名]
base_config = AppConfig()
base_config.renderers = []

base_config.package = convirt

#Set the default renderer
base_config.default_renderer = 'genshi'
base_config.renderers.append('genshi')
# if you want raw speed and have installed chameleon.genshi
# you should try to use this renderer instead.
# warning: for the moment chameleon does not handle i18n translations
#base_config.renderers.append('chameleon_genshi')

#add global providers
base_config.variable_provider = helpers.add_global_tmpl_vars

#Configure the base SQLALchemy Setup
base_config.use_sqlalchemy = True
base_config.model = convirt.model
base_config.DBSession = convirt.model.DBSession

# Configure the authentication backend
base_config.auth_backend = 'sqlalchemy'
base_config.sa_auth.dbsession = model.DBSession
# what is the class you want to use to search for users in the database
base_config.sa_auth.user_class = model.User
# what is the class you want to use to search for groups in the database
base_config.sa_auth.group_class = model.Group
# what is the class you want to use to search for permissions in the database
base_config.sa_auth.permission_class = model.Permission
开发者ID:RDTeam,项目名称:openconvirt,代码行数:32,代码来源:app_cfg.py

示例2: AppConfig

# 需要导入模块: from tg.configuration import AppConfig [as 别名]
# 或者: from tg.configuration.AppConfig import variable_provider [as 别名]
from astportal2 import model
from astportal2.lib import app_globals, helpers 

base_config = AppConfig()
base_config.renderers = []

base_config.package = astportal2

#Configure the base SQLALchemy Setup
base_config.use_sqlalchemy = True
base_config.model = astportal2.model
base_config.DBSession = astportal2.model.DBSession


import tgext.menu
base_config.variable_provider = tgext.menu.menu_variable_provider
# base_config.tgext_menu = {}
# base_config.tgext_menu['inject_css'] = True

# True to prevent dispatcher from striping extensions
# For example /socket.io would be served by "socket_io" method instead of "socket"
base_config.disable_request_extensions = False

# Set None to disable escaping punctuation characters to "_" when dispatching methods.
# Set to a function to provide custom escaping.
base_config.dispatch_path_translator = True 

#Enable json in expose
base_config.renderers.append('json')
#Enable genshi in expose to have a lingua franca for extensions and pluggable apps
#you can remove this if you don't plan to use it.
开发者ID:sysnux,项目名称:astportal,代码行数:33,代码来源:app_cfg.py


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