diff options
Diffstat (limited to 'addons/website/controllers/main.py')
| -rw-r--r-- | addons/website/controllers/main.py | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/addons/website/controllers/main.py b/addons/website/controllers/main.py index e17a216e762..a1cca57919f 100644 --- a/addons/website/controllers/main.py +++ b/addons/website/controllers/main.py @@ -369,10 +369,6 @@ class Website(Home): @http.route(['/website/make_scss_custo'], type='json', auth='user', website=True) def make_scss_custo(self, url, values): """ - Makes a scss customization of the given file. That file must - contain a scss map including a line comment containing the word 'hook', - to indicate the location where to write the new key,value pairs. - Params: url (str): the URL of the scss file to customize (supposed to be a variable @@ -382,24 +378,11 @@ class Website(Home): key,value mapping to integrate in the file's map (containing the word hook). If a key is already in the file's map, its value is overridden. - """ - AssetsUtils = request.env['web_editor.assets'] - - custom_url = AssetsUtils.make_custom_asset_file_url(url, 'web.assets_common') - updatedFileContent = AssetsUtils.get_asset_content(custom_url) or AssetsUtils.get_asset_content(url) - updatedFileContent = updatedFileContent.decode('utf-8') - for name, value in values.items(): - pattern = "'%s': %%s,\n" % name - regex = re.compile(pattern % ".+") - replacement = pattern % value - if regex.search(updatedFileContent): - updatedFileContent = re.sub(regex, replacement, updatedFileContent) - else: - updatedFileContent = re.sub(r'( *)(.*hook.*)', r'\1%s\1\2' % replacement, updatedFileContent) - # Bundle is 'assets_common' as this route is only meant to update - # variables scss files - AssetsUtils.save_asset(url, 'web.assets_common', updatedFileContent, 'scss') + Returns: + boolean + """ + request.env['web_editor.assets'].make_scss_customization(url, values) return True @http.route(['/website/multi_render'], type='json', auth="public", website=True) |
