本文整理汇总了Python中tg.configuration.AppConfig.use_dotted_templatenames方法的典型用法代码示例。如果您正苦于以下问题:Python AppConfig.use_dotted_templatenames方法的具体用法?Python AppConfig.use_dotted_templatenames怎么用?Python AppConfig.use_dotted_templatenames使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tg.configuration.AppConfig
的用法示例。
在下文中一共展示了AppConfig.use_dotted_templatenames方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup
# 需要导入模块: from tg.configuration import AppConfig [as 别名]
# 或者: from tg.configuration.AppConfig import use_dotted_templatenames [as 别名]
def setup(self):
conf = AppConfig(minimal=True)
conf.use_dotted_templatenames = True
conf.renderers.append('mako')
conf.package = FakePackage()
self.conf = conf
self.app = conf.make_wsgi_app()
示例2: test_jinja_lookup_nonexisting_template
# 需要导入模块: from tg.configuration import AppConfig [as 别名]
# 或者: from tg.configuration.AppConfig import use_dotted_templatenames [as 别名]
def test_jinja_lookup_nonexisting_template():
conf = AppConfig(minimal=True)
conf.use_dotted_templatenames = True
conf.renderers.append('jinja')
conf.package = FakePackage()
app = conf.make_wsgi_app()
from jinja2 import TemplateNotFound
try:
render_jinja('tg.this_template_does_not_exists', {'app_globals':tg.config['tg.app_globals']})
assert False
except TemplateNotFound:
pass
示例3: install_gettext_callables
# 需要导入模块: from tg.configuration import AppConfig [as 别名]
# 或者: from tg.configuration.AppConfig import use_dotted_templatenames [as 别名]
def install_gettext_callables(app):
from tg.i18n import ugettext, ungettext
jinja2_env = app_globals.config['pylons.app_globals'].jinja2_env
jinja2_env.install_gettext_callables(ugettext, ungettext)
jinja2_env.autoescape = False
return app
base_config.register_hook('after_config', install_gettext_callables)
#base_config.renderers.append('mako')
# 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')
base_config.use_dotted_templatenames = False
#Configure the base SQLALchemy Setup
base_config.use_sqlalchemy = True
base_config.model = model
base_config.DBSession = 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
示例4: AppConfig
# 需要导入模块: from tg.configuration import AppConfig [as 别名]
# 或者: from tg.configuration.AppConfig import use_dotted_templatenames [as 别名]
# limitations under the License.
from tg.configuration import AppConfig, Bunch
import moksha
from moksha import model
from moksha.lib import app_globals, helpers
base_config = AppConfig()
base_config.package = moksha
# Set the default renderer
base_config.default_renderer = 'mako'
base_config.renderers = []
base_config.renderers.append('genshi')
base_config.renderers.append('mako')
base_config.use_dotted_templatenames = True
# Configure the base SQLALchemy Setup
base_config.use_sqlalchemy = True
base_config.model = moksha.model
base_config.DBSession = moksha.model.DBSession
# Configure the authentication backend
base_config.auth_backend = 'sqlalchemy'
base_config.sa_auth.dbsession = model.DBSession
base_config.sa_auth.user_class = model.User
base_config.sa_auth.group_class = model.Group
base_config.sa_auth.permission_class = model.Permission
# set a default hashing mechanism for the auth system
# this makes sure the passwords are not stored in clear-text