• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python pyramid_webassets.get_webassets_env_from_settings函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test_get_webassets_env_from_settings_no_base_dir

    def test_get_webassets_env_from_settings_no_base_dir(self):
        from pyramid_webassets import get_webassets_env_from_settings

        settings = {'webassets.base_url': '/static'}

        with self.assertRaises(Exception) as cm:
            get_webassets_env_from_settings(settings)

        assert cm.exception.message == "You need to provide webassets.base_dir in your configuration"
开发者ID:sekimura,项目名称:pyramid_webassets,代码行数:9,代码来源:test_webassets.py


示例2: test_get_webassets_env_from_settings_no_base_url

    def test_get_webassets_env_from_settings_no_base_url(self):
        from pyramid_webassets import get_webassets_env_from_settings

        settings = {'webassets.base_dir': '/home'}

        with self.assertRaises(Exception) as cm:
            get_webassets_env_from_settings(settings)

        assert str(cm.exception) == "You need to provide webassets.base_url in your configuration"
开发者ID:dusual,项目名称:pyramid_webassets,代码行数:9,代码来源:test_webassets.py


示例3: test_get_webassets_env_from_settings_prefix_bad_change

    def test_get_webassets_env_from_settings_prefix_bad_change(self):
        from pyramid_webassets import get_webassets_env_from_settings

        settings = {
            'foo.base_url': 'static',
            'foo.base_dir': os.getcwd(),
        }

        with self.assertRaises(Exception) as cm:
            get_webassets_env_from_settings(settings, prefix='webassets')

        assert str(cm.exception) == "You need to provide webassets.base_dir in your configuration"
开发者ID:dusual,项目名称:pyramid_webassets,代码行数:12,代码来源:test_webassets.py


示例4: test_get_webassets_env_from_settings_prefix_bad_change

    def test_get_webassets_env_from_settings_prefix_bad_change(self):
        from pyramid_webassets import get_webassets_env_from_settings

        settings = {
            'foo.base_url': '/static',
            'foo.base_dir': '/home/sontek',
        }

        with self.assertRaises(Exception) as cm:
            get_webassets_env_from_settings(settings, prefix='webassets')

        assert cm.exception.message == "You need to provide webassets.base_dir in your configuration"
开发者ID:0x1997,项目名称:pyramid_webassets,代码行数:12,代码来源:test_webassets.py


示例5: test_bundles_yamlloader_asset

 def test_bundles_yamlloader_asset(self):
     try:
         import yaml
     except ImportError:
         raise unittest.SkipTest('PyYAML not installed')
     from pyramid_webassets import get_webassets_env_from_settings
     settings = {
         'webassets.base_url': 'static',
         'webassets.base_dir': os.getcwd(),
         'webassets.bundles': (
             'dotted.package.name:foo/bar.yaml\n'
             'dotted.package.name:foo/baz.yaml'
         ),
     }
     self.create_files({
         'dotted/__init__.py': '',
         'dotted/package/__init__.py': '',
         'dotted/package/name/__init__.py': '',
         'dotted/package/name/foo/bar.yaml': (
             'mycss: {contents: style/mycssoverride.css}'
         ),
         'dotted/package/name/foo/baz.yaml': (
             'mycss: {contents: style/mycss.css}\n'
             'myjs: {contents: js/myjs.js}'
         ),
     })
     env = get_webassets_env_from_settings(settings)
     self.assertEqual(env.config.get('bundles'), None)
     self.assertIsNotNone(env['mycss'])
     self.assertEqual(sorted(env._named_bundles.keys()), ['mycss', 'myjs'])
     self.assertIn('style/mycssoverride.css', env['mycss'].contents)
开发者ID:dusual,项目名称:pyramid_webassets,代码行数:31,代码来源:test_webassets.py


示例6: test_auto_bool

 def test_auto_bool(self):
     from pyramid_webassets import get_webassets_env_from_settings
     settings = {
         'webassets.base_url': 'static',
         'webassets.base_dir': os.getcwd(),
         'webassets.less_run_in_debug': 'true',
     }
     env = get_webassets_env_from_settings(settings)
     assert env.config['less_run_in_debug'] is True
开发者ID:dusual,项目名称:pyramid_webassets,代码行数:9,代码来源:test_webassets.py


示例7: test_auto_json

 def test_auto_json(self):
     from pyramid_webassets import get_webassets_env_from_settings
     settings = {
         'webassets.base_url': 'static',
         'webassets.base_dir': os.getcwd(),
         'webassets.less_extra_args': 'json:["--foo", "--bar"]',
     }
     env = get_webassets_env_from_settings(settings)
     assert env.config['less_extra_args'] == ['--foo', '--bar']
开发者ID:dusual,项目名称:pyramid_webassets,代码行数:9,代码来源:test_webassets.py


示例8: test_get_webassets_env_from_settings_load_path

    def test_get_webassets_env_from_settings_load_path(self):
        from pyramid_webassets import get_webassets_env_from_settings

        settings = {
            'webassets.base_url': 'static',
            'webassets.base_dir': os.getcwd(),
            'webassets.load_path': '/foo bar/\nbaz'
        }

        env = get_webassets_env_from_settings(settings)

        assert env.load_path == ['/foo', 'bar/', 'baz']
开发者ID:dusual,项目名称:pyramid_webassets,代码行数:12,代码来源:test_webassets.py


示例9: test_get_webassets_env_from_settings_minimal

    def test_get_webassets_env_from_settings_minimal(self):
        from pyramid_webassets import get_webassets_env_from_settings

        settings = {
            'webassets.base_url': '/static',
            'webassets.base_dir': os.getcwd(),
        }

        env = get_webassets_env_from_settings(settings)

        assert env.directory == settings['webassets.base_dir']
        assert env.url == settings['webassets.base_url']
开发者ID:Happystation,项目名称:pyramid_webassets,代码行数:12,代码来源:test_webassets.py


示例10: test_get_webassets_env_from_settings_with_cache

    def test_get_webassets_env_from_settings_with_cache(self):
        from pyramid_webassets import get_webassets_env_from_settings

        settings = {
            'webassets.base_url': '/static',
            'webassets.base_dir': '/home/sontek',
            'webassets.cache': 'true',
        }

        env = get_webassets_env_from_settings(settings)

        assert env.cache != None
开发者ID:0x1997,项目名称:pyramid_webassets,代码行数:12,代码来源:test_webassets.py


示例11: test_get_webassets_env_from_settings_with_cache

    def test_get_webassets_env_from_settings_with_cache(self):
        from pyramid_webassets import get_webassets_env_from_settings

        settings = {
            'webassets.base_url': 'static',
            'webassets.base_dir': os.getcwd(),
            'webassets.cache': 'true',
        }

        env = get_webassets_env_from_settings(settings)

        assert env.cache is not None
开发者ID:dusual,项目名称:pyramid_webassets,代码行数:12,代码来源:test_webassets.py


示例12: test_get_webassets_env_from_settings_asset_spec_dir

    def test_get_webassets_env_from_settings_asset_spec_dir(self):
        import pyramid_webassets
        from pyramid_webassets import get_webassets_env_from_settings

        settings = {
            'webassets.base_url': 'static',
            'webassets.base_dir': 'pyramid_webassets:static',
        }

        env = get_webassets_env_from_settings(settings)
        expected = os.path.join(pyramid_webassets.__path__[0], 'static')

        assert env.directory == expected
开发者ID:dusual,项目名称:pyramid_webassets,代码行数:13,代码来源:test_webassets.py


示例13: test_get_webassets_env_from_settings_prefix_change

    def test_get_webassets_env_from_settings_prefix_change(self):
        from pyramid_webassets import get_webassets_env_from_settings

        settings = {
            'foo.base_url': '/static',
            'foo.base_dir': '/home/sontek',
        }

        env = get_webassets_env_from_settings(settings, prefix='foo')

        assert env != None
        assert env.directory == settings['foo.base_dir']
        assert env.url == settings['foo.base_url']
开发者ID:0x1997,项目名称:pyramid_webassets,代码行数:13,代码来源:test_webassets.py


示例14: test_get_webassets_env_from_settings_dir_with_colon

    def test_get_webassets_env_from_settings_dir_with_colon(self):
        import pyramid_webassets
        from pyramid_webassets import get_webassets_env_from_settings

        settings = {
            'webassets.base_url': 'static',
            'webassets.base_dir': 'here:static',
        }

        env = get_webassets_env_from_settings(settings)
        expected = os.path.abspath('here:static')

        assert env.directory == expected
开发者ID:dusual,项目名称:pyramid_webassets,代码行数:13,代码来源:test_webassets.py


示例15: test_webassets_static_view_setting

    def test_webassets_static_view_setting(self):
        from pyramid_webassets import get_webassets_env_from_settings

        settings = {
            'webassets.base_url': 'static',
            'webassets.base_dir': os.getcwd(),
            'webassets.static_view': True,
        }

        env = get_webassets_env_from_settings(settings)

        assert env is not None
        assert env.config['static_view'] == settings['webassets.static_view']
开发者ID:dusual,项目名称:pyramid_webassets,代码行数:13,代码来源:test_webassets.py


示例16: test_get_webassets_env_from_settings_prefix_change

    def test_get_webassets_env_from_settings_prefix_change(self):
        from pyramid_webassets import get_webassets_env_from_settings

        settings = {
            'foo.base_url': 'static',
            'foo.base_dir': os.getcwd(),
        }

        env = get_webassets_env_from_settings(settings, prefix='foo')

        assert env is not None
        assert env.directory == settings['foo.base_dir']
        assert env.url == '/' + settings['foo.base_url']
开发者ID:dusual,项目名称:pyramid_webassets,代码行数:13,代码来源:test_webassets.py


示例17: test_get_webassets_env_from_settings_autobuild_disabled

    def test_get_webassets_env_from_settings_autobuild_disabled(self):
        from pyramid_webassets import get_webassets_env_from_settings

        settings = {
            'webassets.base_url': '/static',
            'webassets.base_dir': '/home/sontek',
            'webassets.auto_build': 'false'
        }

        env = get_webassets_env_from_settings(settings)

        assert env.directory == settings['webassets.base_dir']
        assert env.url == settings['webassets.base_url']
        assert env.auto_build == False
开发者ID:castersupermild,项目名称:pyramid_webassets,代码行数:14,代码来源:test_webassets.py


示例18: main

def main(argv=sys.argv):
    if len(argv) != 2:
        usage(argv)

    config_uri = argv[1]

    setup_logging(config_uri)
    settings = get_appsettings(config_uri)

    env = get_webassets_env_from_settings(settings)

    for name, bundle in assets:
        print("Building asset {0}".format(name))
        bundle.build(env)
开发者ID:danjac,项目名称:photoapp,代码行数:14,代码来源:build_assets.py


示例19: test_get_webassets_env_from_settings_minimal

    def test_get_webassets_env_from_settings_minimal(self):
        from pyramid_webassets import get_webassets_env_from_settings

        settings = {
            'webassets.base_url': 'static',
            'webassets.base_dir': os.getcwd(),
        }

        env = get_webassets_env_from_settings(settings)

        assert env.directory == settings['webassets.base_dir']
        assert env.url == '/' + settings['webassets.base_url']
        self.assertEqual(env.url_mapping, {})
        self.assertEqual(env.load_path, [])
开发者ID:dusual,项目名称:pyramid_webassets,代码行数:14,代码来源:test_webassets.py


示例20: test_get_webassets_env_from_settings_autobuild_disabled

    def test_get_webassets_env_from_settings_autobuild_disabled(self):
        from pyramid_webassets import get_webassets_env_from_settings

        settings = {
            'webassets.base_url': 'static',
            'webassets.base_dir': os.getcwd(),
            'webassets.auto_build': 'false'
        }

        env = get_webassets_env_from_settings(settings)

        assert env.directory == settings['webassets.base_dir']
        assert env.url == '/' + settings['webassets.base_url']
        assert env.auto_build is False
开发者ID:dusual,项目名称:pyramid_webassets,代码行数:14,代码来源:test_webassets.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python pyramid_zodbconn.get_connection函数代码示例发布时间:2022-05-27
下一篇:
Python pyramid_sqlalchemy.Session类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap