本文整理汇总了Python中fanstatic.NeededResources.render_topbottom方法的典型用法代码示例。如果您正苦于以下问题:Python NeededResources.render_topbottom方法的具体用法?Python NeededResources.render_topbottom怎么用?Python NeededResources.render_topbottom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fanstatic.NeededResources
的用法示例。
在下文中一共展示了NeededResources.render_topbottom方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_bundle_resources_bottomsafe
# 需要导入模块: from fanstatic import NeededResources [as 别名]
# 或者: from fanstatic.NeededResources import render_topbottom [as 别名]
def test_bundle_resources_bottomsafe():
foo = Library('foo', '')
a = Resource(foo, 'a.css')
b = Resource(foo, 'b.css', bottom=True)
needed = NeededResources(resources=[a,b], bundle=True)
assert needed.render_topbottom() == ('''\
<link rel="stylesheet" type="text/css" href="/fanstatic/foo/:bundle:a.css;b.css" />''', '')
needed = NeededResources(resources=[a,b], bundle=True, bottom=True)
assert needed.render_topbottom() == ('''\
<link rel="stylesheet" type="text/css" href="/fanstatic/foo/a.css" />''', '''\
<link rel="stylesheet" type="text/css" href="/fanstatic/foo/b.css" />''')
示例2: test_html_bottom_safe_used_with_minified
# 需要导入模块: from fanstatic import NeededResources [as 别名]
# 或者: from fanstatic.NeededResources import render_topbottom [as 别名]
def test_html_bottom_safe_used_with_minified():
foo = Library('foo', '')
a = Resource(foo, 'a.js', minified='a-minified.js', bottom=True)
needed = NeededResources(minified=True, bottom=True)
needed.need(a)
top, bottom = needed.render_topbottom()
assert top == ''
assert bottom == ('<script type="text/javascript" '
'src="/fanstatic/foo/a-minified.js"></script>')
示例3: test_html_top_bottom_force_bottom
# 需要导入模块: from fanstatic import NeededResources [as 别名]
# 或者: from fanstatic.NeededResources import render_topbottom [as 别名]
def test_html_top_bottom_force_bottom():
foo = Library('foo', '')
x1 = Resource(foo, 'a.js')
x2 = Resource(foo, 'b.css')
y1 = Resource(foo, 'c.js', depends=[x1, x2])
needed = NeededResources(bottom=True, force_bottom=True)
needed.need(y1)
top, bottom = needed.render_topbottom()
assert top == '''\
<link rel="stylesheet" type="text/css" href="/fanstatic/foo/b.css" />'''
assert bottom == '''\
示例4: test_html_bottom_safe
# 需要导入模块: from fanstatic import NeededResources [as 别名]
# 或者: from fanstatic.NeededResources import render_topbottom [as 别名]
def test_html_bottom_safe():
foo = Library('foo', '')
x1 = Resource(foo, 'a.js')
x2 = Resource(foo, 'b.css')
y1 = Resource(foo, 'c.js', depends=[x1, x2])
y2 = Resource(foo, 'y2.js', bottom=True)
needed = NeededResources()
needed.need(y1)
needed.need(y2)
top, bottom = needed.render_topbottom()
assert top == '''\
<link rel="stylesheet" type="text/css" href="/fanstatic/foo/b.css" />
<script type="text/javascript" src="/fanstatic/foo/a.js"></script>
<script type="text/javascript" src="/fanstatic/foo/y2.js"></script>
<script type="text/javascript" src="/fanstatic/foo/c.js"></script>'''
assert bottom == ''
needed = NeededResources(bottom=True)
needed.need(y1)
needed.need(y2)
top, bottom = needed.render_topbottom()
assert top == '''\
<link rel="stylesheet" type="text/css" href="/fanstatic/foo/b.css" />
<script type="text/javascript" src="/fanstatic/foo/a.js"></script>
<script type="text/javascript" src="/fanstatic/foo/c.js"></script>'''
assert bottom == '''\
<script type="text/javascript" src="/fanstatic/foo/y2.js"></script>'''
needed = NeededResources(bottom=True, force_bottom=True)
needed.need(y1)
needed.need(y2)
top, bottom = needed.render_topbottom()
assert top == '''\
<link rel="stylesheet" type="text/css" href="/fanstatic/foo/b.css" />'''
assert bottom == '''\