當前位置: 首頁>>代碼示例>>Python>>正文


Python AssetsBundle.to_html方法代碼示例

本文整理匯總了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))
開發者ID:0967697922,項目名稱:odoo,代碼行數:9,代碼來源:test_assetsbundle.py

示例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)
開發者ID:AlexM-H,項目名稱:odoo,代碼行數:12,代碼來源:test_assetsbundle.py

示例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)
開發者ID:AlexM-H,項目名稱:odoo,代碼行數:12,代碼來源:test_assetsbundle.py

示例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
開發者ID:JoeGazsik,項目名稱:odoo,代碼行數:21,代碼來源:main.py


注:本文中的openerp.addons.base.ir.ir_qweb.AssetsBundle.to_html方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。