Workaround: defusedxml messes up subsequent imports of ElementTree

See https://github.com/tiran/defusedxml/issues/54
This commit is contained in:
Unrud 2020-10-04 10:15:16 +02:00
parent 0b3e4204a5
commit b14889e170

View File

@ -32,12 +32,12 @@ import logging
import posixpath import posixpath
import pprint import pprint
import random import random
import sys
import time import time
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
import zlib import zlib
from http import client from http import client
import defusedxml.ElementTree as DefusedET
import pkg_resources import pkg_resources
from radicale import (auth, httputils, log, pathutils, rights, storage, web, 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.app.report import ApplicationReportMixin
from radicale.log import logger 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 VERSION = pkg_resources.get_distribution("radicale").version