Skip to content

Commit

Permalink
Merge pull request #4245 from Tecnativa/14.0-fix-website-copyright_co…
Browse files Browse the repository at this point in the history
…mpany_name

[14.0][OU-FIX] website: fix extract_footer_copyright_company_name
  • Loading branch information
pedrobaeza authored Nov 30, 2023
2 parents b6312ae + c489fec commit f903e1a
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions openupgrade_scripts/scripts/website/14.0.1.0/post-migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,20 @@ def extract_footer_copyright_company_name(env):
else:
copyright_content = f"Copyright © {website.company_id.name}"
# Set new copyright
website_layout_view = env.ref("website.layout")
website_layout_view = website.with_context(website_id=website.id).viewref(
"website.layout"
)
website_layout_pattern = (
r'<span class="o_footer_copyright_name mr-2">(.*?)<\/span>'
)
website_layout_matches, *_ = re.findall(
website_layout_pattern, website_layout_view.arch_db, re.DOTALL
)
new_arch = website_layout_view.arch_db.replace(
website_layout_matches, copyright_content

new_arch = re.sub(
website_layout_pattern,
lambda match: copyright_content,
website_layout_view.arch_db,
flags=re.DOTALL,
)
website_layout_view.with_context(website_id=website.id).arch_db = new_arch
website_layout_view.with_context(website_id=website.id).arch = new_arch


def website_cookie_notice_post_migration(env):
Expand Down

0 comments on commit f903e1a

Please sign in to comment.