From b14889e17087672952c7f009641e90d507ea90f1 Mon Sep 17 00:00:00 2001 From: Unrud Date: Sun, 4 Oct 2020 10:15:16 +0200 Subject: [PATCH] Workaround: defusedxml messes up subsequent imports of ElementTree See https://github.com/tiran/defusedxml/issues/54 --- radicale/app/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/radicale/app/__init__.py b/radicale/app/__init__.py index 3e95d8f..21dcd11 100644 --- a/radicale/app/__init__.py +++ b/radicale/app/__init__.py @@ -32,12 +32,12 @@ import logging import posixpath import pprint import random +import sys import time import xml.etree.ElementTree as ET import zlib from http import client -import defusedxml.ElementTree as DefusedET import pkg_resources from radicale import (auth, httputils, log, pathutils, rights, storage, web, @@ -56,6 +56,10 @@ from radicale.app.put import ApplicationPutMixin from radicale.app.report import ApplicationReportMixin from radicale.log import logger +# WORKAROUND: https://github.com/tiran/defusedxml/issues/54 +import defusedxml.ElementTree as DefusedET # isort: skip +sys.modules["xml.etree"].ElementTree = ET + VERSION = pkg_resources.get_distribution("radicale").version