Various minor typo fixes

This commit is contained in:
Guillaume Ayoub 2011-05-11 06:19:05 +02:00
parent 7e1815cbeb
commit aacfa8ff46

View File

@ -42,20 +42,21 @@ for short, url in NAMESPACES.items():
ET._namespace_map[url] = short ET._namespace_map[url] = short
def _et_indent(elem, level=0): def _et_indent(element, level=0):
"""Indent an ElementTree ``element`` and its children."""
i = "\n" + level * " " i = "\n" + level * " "
if len(elem): if len(element):
if not elem.text or not elem.text.strip(): if not element.text or not element.text.strip():
elem.text = i + " " element.text = i + " "
if not elem.tail or not elem.tail.strip(): if not element.tail or not element.tail.strip():
elem.tail = i element.tail = i
for elem in elem: for sub_element in element:
_et_indent(elem, level+1) _et_indent(sub_element, level + 1)
if not elem.tail or not elem.tail.strip(): if not sub_element.tail or not sub_element.tail.strip():
elem.tail = i sub_element.tail = i
else: else:
if level and (not elem.tail or not elem.tail.strip()): if level and (not element.tail or not element.tail.strip()):
elem.tail = i element.tail = i
def _tag(short_name, local): def _tag(short_name, local):
@ -279,8 +280,9 @@ def report(path, xml_request, calendar):
if calendar: if calendar:
if root.tag == _tag("C", "calendar-multiget"): if root.tag == _tag("C", "calendar-multiget"):
# Read rfc4791-7.9 for info # Read rfc4791-7.9 for info
hreferences = set((href_element.text for href_element hreferences = set(
in root.findall(_tag("D", "href")))) href_element.text for href_element
in root.findall(_tag("D", "href")))
else: else:
hreferences = (path,) hreferences = (path,)
else: else: