Enhance readability according to PEP8

This commit is contained in:
Guillaume Ayoub 2012-08-03 14:08:11 +02:00
parent f593ab0fbd
commit 7ae764fd4b
3 changed files with 16 additions and 18 deletions

View File

@ -172,7 +172,7 @@ class Application(object):
def __call__(self, environ, start_response):
"""Manage a request."""
log.LOGGER.info("%s request at %s received" % (
environ["REQUEST_METHOD"], environ["PATH_INFO"]))
environ["REQUEST_METHOD"], environ["PATH_INFO"]))
headers = pprint.pformat(self.headers_log(environ))
log.LOGGER.debug("Request headers:\n%s" % headers)
@ -439,7 +439,7 @@ class Application(object):
# Evolution bug workaround
etag = environ.get("HTTP_IF_MATCH", "").replace("\\", "")
if (not item and not etag) or (
item and ((etag or item.etag) == item.etag)):
item and ((etag or item.etag) == item.etag)):
# PUT allowed in 3 cases
# Case 1: No item and no ETag precondition: Add new item
# Case 2: Item and ETag precondition verified: Modify item

View File

@ -68,10 +68,10 @@ INITIAL_CONFIG = {
"courier_socket": ""},
"storage": {
"type": "filesystem",
"filesystem_folder":
os.path.expanduser("~/.config/radicale/collections"),
"git_folder":
os.path.expanduser("~/.config/radicale/collections")},
"filesystem_folder": os.path.expanduser(
"~/.config/radicale/collections"),
"git_folder": os.path.expanduser(
"~/.config/radicale/collections")},
"logging": {
"config": "/etc/radicale/logging",
"debug": "False",

View File

@ -239,11 +239,10 @@ def _propfind_response(path, item, props, user):
tag = ET.Element(_tag("D", "href"))
tag.text = path
element.append(tag)
elif tag in (
_tag("D", "principal-collection-set"),
_tag("C", "calendar-user-address-set"),
_tag("CR", "addressbook-home-set"),
_tag("C", "calendar-home-set")):
elif tag in (_tag("D", "principal-collection-set"),
_tag("C", "calendar-user-address-set"),
_tag("CR", "addressbook-home-set"),
_tag("C", "calendar-home-set")):
tag = ET.Element(_tag("D", "href"))
tag.text = path
element.append(tag)
@ -269,8 +268,8 @@ def _propfind_response(path, item, props, user):
element.append(privilege)
elif tag == _tag("D", "supported-report-set"):
for report_name in (
"principal-property-search", "sync-collection"
"expand-property", "principal-search-property-set"):
"principal-property-search", "sync-collection"
"expand-property", "principal-search-property-set"):
supported = ET.Element(_tag("D", "supported-report"))
report_tag = ET.Element(_tag("D", "report"))
report_tag.text = report_name
@ -425,9 +424,8 @@ def report(path, xml_request, collection):
props = [prop.tag for prop in prop_element]
if collection:
if root.tag in (
_tag("C", "calendar-multiget"),
_tag("CR", "addressbook-multiget")):
if root.tag in (_tag("C", "calendar-multiget"),
_tag("CR", "addressbook-multiget")):
# Read rfc4791-7.9 for info
hreferences = set(
href_element.text for href_element
@ -485,8 +483,8 @@ def report(path, xml_request, collection):
element = ET.Element(tag)
if tag == _tag("D", "getetag"):
element.text = item.etag
elif tag in (
_tag("C", "calendar-data"), _tag("CR", "address-data")):
elif tag in (_tag("C", "calendar-data"),
_tag("CR", "address-data")):
if isinstance(item, ical.Component):
element.text = ical.serialize(
collection_tag, collection_headers,