本文整理汇总了Python中openerp.addons.base.ir.ir_qweb.AssetsBundle.to_html方法的典型用法代码示例。如果您正苦于以下问题:Python AssetsBundle.to_html方法的具体用法?Python AssetsBundle.to_html怎么用?Python AssetsBundle.to_html使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openerp.addons.base.ir.ir_qweb.AssetsBundle
的用法示例。
在下文中一共展示了AssetsBundle.to_html方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _bundle
# 需要导入模块: from openerp.addons.base.ir.ir_qweb import AssetsBundle [as 别名]
# 或者: from openerp.addons.base.ir.ir_qweb.AssetsBundle import to_html [as 别名]
def _bundle(self, should_create, should_unlink):
self.counter.clear()
files, remains = self.env['ir.qweb']._get_asset_content(self.lessbundle_xmlid, {})
asset = AssetsBundle(self.lessbundle_xmlid, files, remains, env=self.env)
asset.to_html(debug='assets')
self.assertEquals(self.counter['create'], int(should_create))
self.assertEquals(self.counter['unlink'], int(should_unlink))
示例2: test_12_paginated_css_debug
# 需要导入模块: from openerp.addons.base.ir.ir_qweb import AssetsBundle [as 别名]
# 或者: from openerp.addons.base.ir.ir_qweb.AssetsBundle import to_html [as 别名]
def test_12_paginated_css_debug(self):
""" Check that a bundle in debug mode outputs non-minified assets.
"""
debug_bundle = AssetsBundle(self.cssbundle_xmlid, cr=self.cr, uid=self.uid, context={}, registry=self.registry, max_css_rules=1)
content = debug_bundle.to_html(debug=True)
# find back one of the original asset file
self.assertIn('/test_assetsbundle/static/src/css/test_cssfile1.css', content)
# there shouldn't be any assets created in debug mode
self.assertEquals(len(self._any_ira_for_bundle('css')), 0)
示例3: test_05_debug
# 需要导入模块: from openerp.addons.base.ir.ir_qweb import AssetsBundle [as 别名]
# 或者: from openerp.addons.base.ir.ir_qweb.AssetsBundle import to_html [as 别名]
def test_05_debug(self):
""" Checks that a bundle rendered in debug mode outputs non-minified assets.
"""
debug_bundle = AssetsBundle(self.jsbundle_xmlid, cr=self.cr, uid=self.uid, context={}, registry=self.registry)
content = debug_bundle.to_html(debug=True)
# find back one of the original asset file
self.assertIn('/test_assetsbundle/static/src/js/test_jsfile1.js', content)
# there shouldn't be any assets created in debug mode
self.assertEquals(len(self._any_ira_for_bundle('js')), 0)
示例4: theme_customize
# 需要导入模块: from openerp.addons.base.ir.ir_qweb import AssetsBundle [as 别名]
# 或者: from openerp.addons.base.ir.ir_qweb.AssetsBundle import to_html [as 别名]
def theme_customize(self, enable, disable, get_bundle=False):
""" enable or Disable lists of ``xml_id`` of the inherit templates
"""
cr, uid, context, pool = request.cr, request.uid, request.context, request.registry
view = pool["ir.ui.view"]
context = dict(request.context or {}, active_test=True)
def set_active(ids, active):
if ids:
view.write(cr, uid, self.get_view_ids(ids), {'active': active}, context=context)
set_active(disable, False)
set_active(enable, True)
if get_bundle:
bundle = AssetsBundle('website.assets_frontend', cr=http.request.cr, uid=http.request.uid, context={}, registry=http.request.registry)
return bundle.to_html()
return True