fix: DeprecationWarning: invalid escape sequence \<

Python 3 interprets string literals as Unicode strings, and therefore your \< and \> are treated as an escaped Unicode character.

Declare your RegEx pattern as a raw string instead by prepending r
This commit is contained in:
Joseph Marie Alba 2021-05-16 06:13:14 +08:00 committed by GitHub
parent d84d02349c
commit 9795545fb6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -34,10 +34,10 @@ def get_context(context):
boot_json = frappe.as_json(boot)
# remove script tags from boot
boot_json = re.sub("\<script[^<]*\</script\>", "", boot_json)
boot_json = re.sub(r"\<script[^<]*\</script\>", "", boot_json)
# TODO: Find better fix
boot_json = re.sub("</script\>", "", boot_json)
boot_json = re.sub(r"</script\>", "", boot_json)
context.update({
"no_cache": 1,