From e4523bf8622bdbdbb15789060f0b14ecba383f44 Mon Sep 17 00:00:00 2001 From: Guillaume Ayoub Date: Tue, 9 Aug 2011 14:35:34 +0200 Subject: [PATCH] Clean the "Radicale works!" message, put it in the "get" method --- radicale/__init__.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/radicale/__init__.py b/radicale/__init__.py index 98d0cb9..d2a7f38 100644 --- a/radicale/__init__.py +++ b/radicale/__init__.py @@ -161,18 +161,6 @@ class Application(object): environ["PATH_INFO"] = self.sanitize_uri(environ["PATH_INFO"]) log.LOGGER.debug("Sanitized path: %s", environ["PATH_INFO"]) - # Display an "It Works" message if the root URL is requested with - # the GET method - if environ["REQUEST_METHOD"].lower() == "get" \ - and environ["PATH_INFO"] == "/": - headers = {"Content-type": "text/html"} - start_response("200 OK", list(headers.items())) - return ["\n", - "Radicale Works!\n", - "

Radicale Works!

", - 'radicale.org', - "\n"] - # Get content content_length = int(environ.get("CONTENT_LENGTH") or 0) if content_length: @@ -281,6 +269,12 @@ class Application(object): def get(self, environ, calendars, content, user): """Manage GET request.""" + # Display a "Radicale works!" message if the root URL is requested + if environ["PATH_INFO"] == "/": + headers = {"Content-type": "text/html"} + answer = "\nRadicaleRadicale works!" + return client.OK, headers, answer + calendar = calendars[0] item_name = xmlutils.name_from_path(environ["PATH_INFO"], calendar) if item_name: