Merge branch 'master' of git://gitorious.org/radicale/radicale
Conflicts: radicale/xmlutils.py
This commit is contained in:
commit
3a9226ca80
@ -154,6 +154,7 @@ class CalendarHTTPHandler(server.BaseHTTPRequestHandler):
|
|||||||
def do_GET(self):
|
def do_GET(self):
|
||||||
"""Manage GET request."""
|
"""Manage GET request."""
|
||||||
self.do_HEAD()
|
self.do_HEAD()
|
||||||
|
if self._answer:
|
||||||
self.wfile.write(self._answer)
|
self.wfile.write(self._answer)
|
||||||
|
|
||||||
@check_rights
|
@check_rights
|
||||||
@ -170,6 +171,7 @@ class CalendarHTTPHandler(server.BaseHTTPRequestHandler):
|
|||||||
headers=self._calendar.headers, items=items)
|
headers=self._calendar.headers, items=items)
|
||||||
etag = item.etag
|
etag = item.etag
|
||||||
else:
|
else:
|
||||||
|
self._answer = None
|
||||||
self.send_response(client.GONE)
|
self.send_response(client.GONE)
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
|
@ -52,7 +52,8 @@ def _response(code):
|
|||||||
|
|
||||||
def name_from_path(path):
|
def name_from_path(path):
|
||||||
"""Return Radicale item name from ``path``."""
|
"""Return Radicale item name from ``path``."""
|
||||||
return path.split("/")[-1]
|
path_parts = path.strip("/").split("/")
|
||||||
|
return path_parts[-1] if len(path_parts) > 2 else None
|
||||||
|
|
||||||
|
|
||||||
def delete(path, calendar):
|
def delete(path, calendar):
|
||||||
@ -97,22 +98,22 @@ def propfind(path, xml_request, calendar, depth, request):
|
|||||||
multistatus = ET.Element(_tag("D", "multistatus"))
|
multistatus = ET.Element(_tag("D", "multistatus"))
|
||||||
|
|
||||||
if depth == "0":
|
if depth == "0":
|
||||||
elements = [calendar]
|
items = [calendar]
|
||||||
elif depth == "1":
|
elif depth == "1":
|
||||||
elements = [calendar] + calendar.events + calendar.todos
|
items = [calendar] + calendar.events + calendar.todos
|
||||||
else:
|
else:
|
||||||
# depth is infinity or not specified
|
# depth is infinity or not specified
|
||||||
# we limit ourselves to depth == 1
|
# we limit ourselves to depth == 1
|
||||||
elements = [calendar] + calendar.events + calendar.todos
|
items = [calendar] + calendar.events + calendar.todos
|
||||||
|
|
||||||
for element in elements:
|
for item in items:
|
||||||
is_calendar = isinstance(element, ical.Calendar)
|
is_calendar = isinstance(item, ical.Calendar)
|
||||||
|
|
||||||
response = ET.Element(_tag("D", "response"))
|
response = ET.Element(_tag("D", "response"))
|
||||||
multistatus.append(response)
|
multistatus.append(response)
|
||||||
|
|
||||||
href = ET.Element(_tag("D", "href"))
|
href = ET.Element(_tag("D", "href"))
|
||||||
href.text = path if is_calendar else "%s/%s" % (path, element.name)
|
href.text = path if is_calendar else "%s/%s" % (path, item.name)
|
||||||
response.append(href)
|
response.append(href)
|
||||||
|
|
||||||
propstat = ET.Element(_tag("D", "propstat"))
|
propstat = ET.Element(_tag("D", "propstat"))
|
||||||
@ -138,7 +139,7 @@ def propfind(path, xml_request, calendar, depth, request):
|
|||||||
elif tag == _tag("D", "getcontenttype"):
|
elif tag == _tag("D", "getcontenttype"):
|
||||||
element.text = "text/calendar"
|
element.text = "text/calendar"
|
||||||
elif tag == _tag("D", "getetag"):
|
elif tag == _tag("D", "getetag"):
|
||||||
element.text = element.tag
|
element.text = item.etag
|
||||||
elif tag == _tag("D", "displayname"):
|
elif tag == _tag("D", "displayname"):
|
||||||
element.text = calendar.name
|
element.text = calendar.name
|
||||||
elif tag == _tag("D", "supported-report-set"):
|
elif tag == _tag("D", "supported-report-set"):
|
||||||
|
Loading…
Reference in New Issue
Block a user