Skip to content

Commit be91fed

Browse files
qsm-odoobso-odoo
authored andcommitted
[FIX] snippets: properly unwrap during xml upgrade
We wrap the content to upgrade into a `<wrap>` element before upgrading it. After the upgrade, we unwrap the content using `re.sub`... but this did not consider the case where there is no content in the wrapper anymore. Indeed, in that case, the XML formatter sets the content to "<wrap/>" and not "<wrap></wrap>". Related to community odoo/odoo#172755 Related to enterprise odoo/enterprise#66488 Related to upgrade odoo/upgrade#6254 Related to task-4008369 closes #113 Related: odoo/odoo#172755 Related: odoo/enterprise#66488 Related: odoo/upgrade#6254 Signed-off-by: Alvaro Fuentes Suarez (afu) <[email protected]>
1 parent b7660bd commit be91fed

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/util/snippets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ def __call__(self, content):
205205
)
206206
has_changed = self.has_changed(els)
207207
new_content = (
208-
re.sub(r"(^<wrap>|</wrap>$)", "", etree.tostring(els, encoding="unicode").strip())
208+
re.sub(r"(^<wrap>|</wrap>$|^<wrap/>$)", "", etree.tostring(els, encoding="unicode").strip())
209209
if has_changed
210210
else content
211211
)

0 commit comments

Comments
 (0)