Fix get requests for whole calendar

This commit is contained in:
Guillaume Ayoub 2010-12-20 15:49:48 +01:00
parent 72f3af9ab9
commit 091d89889d
2 changed files with 5 additions and 2 deletions

View File

@ -154,7 +154,8 @@ class CalendarHTTPHandler(server.BaseHTTPRequestHandler):
def do_GET(self): def do_GET(self):
"""Manage GET request.""" """Manage GET request."""
self.do_HEAD() self.do_HEAD()
self.wfile.write(self._answer) if self._answer:
self.wfile.write(self._answer)
@check_rights @check_rights
def do_HEAD(self): def do_HEAD(self):
@ -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:

View File

@ -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):