[FIX] base: keep _get_asset for retro compatibility
Return of _get_assets has been altered with commit 9cd982bcc8
We keep it for retro compatibility, but devs that override it before need to
override now _get_asset_node to be called correctly by t-call-asset.
This commit is contained in:
@@ -174,7 +174,7 @@ class IrQWeb(models.AbstractModel, QWeb):
|
||||
value=ast.Call(
|
||||
func=ast.Attribute(
|
||||
value=ast.Name(id='self', ctx=ast.Load()),
|
||||
attr='_get_asset',
|
||||
attr='_get_asset_nodes',
|
||||
ctx=ast.Load()
|
||||
),
|
||||
args=[
|
||||
@@ -286,13 +286,23 @@ class IrQWeb(models.AbstractModel, QWeb):
|
||||
|
||||
# method called by computing code
|
||||
|
||||
# compatibility to remove after v11 - DEPRECATED
|
||||
@tools.conditional(
|
||||
'xml' not in tools.config['dev_mode'],
|
||||
tools.ormcache_context('xmlid', 'options.get("lang", "en_US")', 'css', 'js', 'debug', 'async', keys=("website_id",)),
|
||||
)
|
||||
def _get_asset(self, xmlid, options, css=True, js=True, debug=False, async=False, values=None):
|
||||
files, remains = self._get_asset_content(xmlid, options)
|
||||
asset = AssetsBundle(xmlid, files, remains, env=self.env)
|
||||
return asset.to_html(css=css, js=js, debug=debug, async=async, url_for=(values or {}).get('url_for', lambda url: url))
|
||||
|
||||
@tools.conditional(
|
||||
# in non-xml-debug mode we want assets to be cached forever, and the admin can force a cache clear
|
||||
# by restarting the server after updating the source code (or using the "Clear server cache" in debug tools)
|
||||
'xml' not in tools.config['dev_mode'],
|
||||
tools.ormcache_context('xmlid', 'options.get("lang", "en_US")', 'css', 'js', 'debug', 'async', keys=("website_id",)),
|
||||
)
|
||||
def _get_asset(self, xmlid, options, css=True, js=True, debug=False, async=False, values=None):
|
||||
def _get_asset_nodes(self, xmlid, options, css=True, js=True, debug=False, async=False, values=None):
|
||||
files, remains = self._get_asset_content(xmlid, options)
|
||||
asset = AssetsBundle(xmlid, files, env=self.env)
|
||||
remains = [node for node in remains if (css and node[0] == 'link') or (js and node[0] != 'link')]
|
||||
|
||||
Reference in New Issue
Block a user