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


Python pyramid_jinja2.includeme函数代码示例

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


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

示例1: test_directory

 def test_directory(self):
     from pyramid_jinja2 import includeme
     config = testing.setUp()
     config.registry.settings['jinja2.bytecode_caching_directory'] = '/foobar'
     includeme(config)
     env = config.get_jinja2_environment()
     self.assertEqual(env.bytecode_cache.directory, text_('/foobar'))
开发者ID:0x1997,项目名称:pyramid_jinja2,代码行数:7,代码来源:test_it.py

示例2: test_it

 def test_it(self):
     from jinja2.environment import Environment
     from pyramid_jinja2 import includeme
     config = testing.setUp()
     includeme(config)
     self.assertEqual(config.get_jinja2_environment().__class__,
                      Environment)
开发者ID:Mbosco,项目名称:pyramid_jinja2,代码行数:7,代码来源:test_it.py

示例3: test_it_relative_to_package

    def test_it_relative_to_package(self):
        import pyramid_jinja2.tests
        from pyramid_jinja2 import includeme
        import os
        config = testing.setUp()
        # hack because pyramid pre 1.6 doesn't configure testing configurator
        # with the correct package name
        config.package = pyramid_jinja2.tests
        config.package_name = 'pyramid_jinja2.tests'
        config.add_settings({'jinja2.directories': 'foobar'})
        includeme(config)
        env = config.get_jinja2_environment()
        self.assertEqual(
            [x.split(os.sep)[-2:] for x in env.loader.searchpath][0],
            ['pyramid_jinja2', 'tests'])
        self.assertEqual(
            [x.split(os.sep)[-3:] for x in env.loader.searchpath][1:],
            [['pyramid_jinja2', 'tests', 'foobar']])

        config.add_jinja2_search_path('grrr')
        self.assertEqual(
            [x.split(os.sep)[-2:] for x in env.loader.searchpath][0],
            ['pyramid_jinja2', 'tests'])
        self.assertEqual(
            [x.split(os.sep)[-3:] for x in env.loader.searchpath][1:],
            [['pyramid_jinja2', 'tests', 'foobar'],
             ['pyramid_jinja2', 'tests', 'grrr']])
开发者ID:renierdbruyn,项目名称:pyramid_jinja2,代码行数:27,代码来源:test_it.py

示例4: test_pyramid_reload_templates

 def test_pyramid_reload_templates(self):
     from pyramid_jinja2 import includeme
     config = testing.setUp()
     config.registry.settings = {}
     config.registry.settings['pyramid.reload_templates'] = 'true'
     includeme(config)
     env = config.get_jinja2_environment()
     self.assertTrue(env.auto_reload)
开发者ID:Mbosco,项目名称:pyramid_jinja2,代码行数:8,代码来源:test_it.py

示例5: test_it

 def test_it(self):
     from pyramid.interfaces import IRendererFactory
     from pyramid_jinja2 import includeme
     from pyramid_jinja2 import renderer_factory
     config = testing.setUp()
     includeme(config)
     utility = config.registry.getUtility(IRendererFactory, name='.jinja2')
     self.assertEqual(utility, renderer_factory)
开发者ID:blaflamme,项目名称:pyramid_jinja2,代码行数:8,代码来源:test_it.py

示例6: test_default

 def test_default(self):
     from pyramid_jinja2 import includeme
     config = testing.setUp()
     config.registry.settings = {}
     includeme(config)
     env = config.get_jinja2_environment()
     self.assertTrue(env.bytecode_cache is None)
     self.assertFalse(env.auto_reload)
开发者ID:renierdbruyn,项目名称:pyramid_jinja2,代码行数:8,代码来源:test_it.py

示例7: test_directory

 def test_directory(self):
     import tempfile
     from pyramid_jinja2 import includeme
     tmpdir = tempfile.mkdtemp()
     config = testing.setUp()
     config.registry.settings['jinja2.bytecode_caching_directory'] = tmpdir
     includeme(config)
     env = config.get_jinja2_environment()
     self.assertEqual(env.bytecode_cache.directory, tmpdir)
开发者ID:Mbosco,项目名称:pyramid_jinja2,代码行数:9,代码来源:test_it.py

示例8: test_default

 def test_default(self):
     from pyramid_jinja2 import includeme
     import jinja2.bccache
     config = testing.setUp()
     includeme(config)
     env = config.get_jinja2_environment()
     self.assertTrue(isinstance(env.bytecode_cache,
                                jinja2.bccache.FileSystemBytecodeCache))
     self.assertTrue(env.bytecode_cache.directory)
开发者ID:0x1997,项目名称:pyramid_jinja2,代码行数:9,代码来源:test_it.py

示例9: test_it

 def test_it(self):
     from pyramid.interfaces import IRendererFactory
     from pyramid_jinja2 import includeme
     from pyramid_jinja2 import Jinja2RendererFactory
     config = testing.setUp()
     config.registry.settings['jinja2.directories'] = '/foobar'
     includeme(config)
     utility = config.registry.getUtility(IRendererFactory, name='.jinja2')
     self.assertTrue(isinstance(utility, Jinja2RendererFactory))
开发者ID:renierdbruyn,项目名称:pyramid_jinja2,代码行数:9,代码来源:test_it.py

示例10: test_bccache_instance

 def test_bccache_instance(self):
     from pyramid_jinja2 import includeme
     import jinja2.bccache
     mycache = jinja2.bccache.MemcachedBytecodeCache(DummyMemcachedClient())
     config = testing.setUp()
     config.registry.settings = {'jinja2.bytecode_caching': mycache}
     includeme(config)
     env = config.get_jinja2_environment()
     self.assertTrue(env.bytecode_cache is mycache)
     self.assertFalse(env.auto_reload)
开发者ID:renierdbruyn,项目名称:pyramid_jinja2,代码行数:10,代码来源:test_it.py

示例11: test_default_bccache

 def test_default_bccache(self):
     from pyramid_jinja2 import includeme
     import jinja2.bccache
     config = testing.setUp()
     config.registry.settings = {'jinja2.bytecode_caching': 'true'}
     includeme(config)
     env = config.get_jinja2_environment()
     self.assertTrue(isinstance(env.bytecode_cache,
                                jinja2.bccache.FileSystemBytecodeCache))
     self.assertTrue(env.bytecode_cache.directory)
     self.assertFalse(env.auto_reload)
开发者ID:renierdbruyn,项目名称:pyramid_jinja2,代码行数:11,代码来源:test_it.py

示例12: setUp

 def setUp(self):
     from pyramid_jinja2 import includeme
     import jinja2.bccache
     config = testing.setUp()
     config.registry.settings = {}
     includeme(config)
     self.environment = config.get_jinja2_environment()
     from pyramid_jinja2.filters import route_url_filter
     self.environment.filters['route_url'] = route_url_filter
     from pyramid.config import Configurator
     self.config = Configurator(autocommit=True)
开发者ID:Mbosco,项目名称:pyramid_jinja2,代码行数:11,代码来源:test_filters.py

示例13: test_it

 def test_it(self):
     from pyramid_jinja2 import includeme
     from pyramid_jinja2 import IJinja2Environment
     import os
     config = testing.setUp()
     config.registry.settings['jinja2.directories'] = 'foobar'
     includeme(config)
     utility = config.registry.getUtility(IJinja2Environment)
     self.assertEqual([x.split(os.sep)[-1]
                       for x in utility.loader.searchpath], ['foobar'])
     config.add_jinja2_search_path('grrr')
     self.assertEqual([x.split(os.sep)[-1]
                       for x in utility.loader.searchpath],
                      ['foobar', 'grrr'])
开发者ID:nek4life,项目名称:pyramid_jinja2,代码行数:14,代码来源:test_it.py

示例14: test_it

    def test_it(self):
        import pyramid_jinja2.tests
        from pyramid_jinja2 import includeme
        import os
        config = testing.setUp()
        config.package = pyramid_jinja2.tests
        config.registry.settings['jinja2.directories'] = 'foobar'
        includeme(config)
        env = config.get_jinja2_environment()
        self.assertEqual(
            [x.split(os.sep)[-3:] for x in env.loader.searchpath],
            [['pyramid_jinja2', 'tests', 'foobar']])

        config.add_jinja2_search_path('grrr')
        self.assertEqual(
            [x.split(os.sep)[-3:] for x in env.loader.searchpath],
            [['pyramid_jinja2', 'tests', 'foobar'], ['pyramid_jinja2', 'tests', 'grrr']])
开发者ID:goodwillcoding,项目名称:pyramid_jinja2,代码行数:17,代码来源:test_it.py

示例15: test_it_relative

    def test_it_relative(self):
        from pyramid.config import Configurator
        from pyramid_jinja2 import includeme
        from webtest import TestApp

        def myview(request):
            return {}

        config = Configurator(settings={'jinja2.directories': 'templates'})
        includeme(config)
        config.add_view(view=myview, name='baz1',
                        renderer='baz1/mytemplate.jinja2')
        config.add_view(view=myview, name='baz2',
                        renderer='baz2/mytemplate.jinja2')

        app1 = config.make_wsgi_app()
        testapp = TestApp(app1)
        self.assertEqual(testapp.get('/baz1').body, bytes_('baz1\nbaz1 body'))
        self.assertEqual(testapp.get('/baz2').body, bytes_('baz2\nbaz2 body'))
开发者ID:renierdbruyn,项目名称:pyramid_jinja2,代码行数:19,代码来源:test_it.py


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