Remove the useless ElementTree protected namespaces hack.

This commit is contained in:
Guillaume Ayoub 2010-04-10 16:26:22 +02:00
parent c7820b87e0
commit 9a9342a1bd

View File

@ -34,20 +34,15 @@ import xml.etree.ElementTree as ET
from radicale import client, config, ical from radicale import client, config, ical
# TODO: This is a well-known and accepted hack for ET to avoid ET from renaming NAMESPACES = {
# namespaces, which is accepted in XML norm but often not in XML
# readers. Is there another clean solution to force namespaces?
PROTECTED_NAMESPACES = {
"C": "urn:ietf:params:xml:ns:caldav", "C": "urn:ietf:params:xml:ns:caldav",
"D": "DAV:", "D": "DAV:",
"CS": "http://calendarserver.org/ns/"} "CS": "http://calendarserver.org/ns/"}
for key, value in PROTECTED_NAMESPACES.items():
ET._namespace_map[value] = key
def _tag(short_name, local): def _tag(short_name, local):
"""Get XML Clark notation {uri(``short_name``)}``local``.""" """Get XML Clark notation {uri(``short_name``)}``local``."""
return "{%s}%s" % (PROTECTED_NAMESPACES[short_name], local) return "{%s}%s" % (NAMESPACES[short_name], local)
def _response(code): def _response(code):