本文整理汇总了Python中tg.configuration.AppConfig.renderers方法的典型用法代码示例。如果您正苦于以下问题:Python AppConfig.renderers方法的具体用法?Python AppConfig.renderers怎么用?Python AppConfig.renderers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tg.configuration.AppConfig
的用法示例。
在下文中一共展示了AppConfig.renderers方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_setup_jinja_without_package
# 需要导入模块: from tg.configuration import AppConfig [as 别名]
# 或者: from tg.configuration.AppConfig import renderers [as 别名]
def test_setup_jinja_without_package(self):
class RootController(TGController):
@expose()
def test(self):
return 'HI!'
conf = AppConfig(minimal=True, root_controller=RootController())
conf.renderers = ['jinja']
app = conf.make_wsgi_app()
示例2: setup
# 需要导入模块: from tg.configuration import AppConfig [as 别名]
# 或者: from tg.configuration.AppConfig import renderers [as 别名]
def setup(self):
conf = AppConfig(minimal=True, root_controller=i18nRootController())
conf['paths']['root'] = 'tests'
conf['i18n_enabled'] = True
conf['use_sessions'] = True
conf['beaker.session.key'] = 'tg_test_session'
conf['beaker.session.secret'] = 'this-is-some-secret'
conf.renderers = ['json']
conf.default_renderer = 'json'
conf.package = _FakePackage()
app = conf.make_wsgi_app()
self.app = TestApp(app)
示例3: asbool
# 需要导入模块: from tg.configuration import AppConfig [as 别名]
# 或者: from tg.configuration.AppConfig import renderers [as 别名]
convert them into boolean, for example, you should use the
:func:`paste.deploy.converters.asbool` function, as in::
from paste.deploy.converters import asbool
setting = asbool(global_conf.get('the_setting'))
"""
from tg.configuration import AppConfig
import wsginiu
from wsginiu import model
from wsginiu.lib import app_globals, helpers
base_config = AppConfig()
base_config.renderers = []
base_config.package = wsginiu
#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')
#Configure the base SQLALchemy Setup
base_config.use_sqlalchemy = True
base_config.model = wsginiu.model
base_config.DBSession = wsginiu.model.DBSession
示例4: RootController
# 需要导入模块: from tg.configuration import AppConfig [as 别名]
# 或者: from tg.configuration.AppConfig import renderers [as 别名]
from wsgiref.simple_server import make_server
import sys
import tg
from tg.configuration import AppConfig
from tg import TGController, expose
class RootController(TGController):
@expose()
def index(self, *args, **kw):
return 'HELLO FROM %s' % tg.request.path
@expose()
def somewhere(self):
return 'WELCOME SOMEWHERE'
@expose('testapp.mak')
def test(self):
return dict(ip=tg.request.remote_addr)
app_config = AppConfig(minimal=True)
app_config['tg.root_controller'] = RootController()
#Setup support for MAKO.
app_config.renderers = ['mako']
app_config.default_renderer = 'mako'
app_config.use_dotted_templatenames = False
app = app_config.make_wsgi_app()
make_server('', 8080, app).serve_forever()
示例5: AppConfig
# 需要导入模块: from tg.configuration import AppConfig [as 别名]
# 或者: from tg.configuration.AppConfig import renderers [as 别名]
"""
import logging
from tg.configuration import AppConfig
import hollyrosa
from hollyrosa.model.booking_couch import getVisitingGroupByBoknr
from hollyrosa import model, lib
from hollyrosa.lib import app_globals, helpers
from hollyrosa.controllers.common import DataContainer
import hashlib
base_config = AppConfig()
base_config.renderers = ['kajiki']
# 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
base_config.prefer_toscawidgets2 = True
base_config.package = hollyrosa
base_config.custom_tw2_config['script_name'] = '/hollyrosa' # hollyrosa in production