From 1f9c5687200883ebe8a469f02248dea930023d13 Mon Sep 17 00:00:00 2001 From: Guillaume Ayoub Date: Wed, 22 Oct 2014 11:32:25 +0200 Subject: [PATCH] Don't recreate the regular expression for each request --- radicale/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/radicale/__init__.py b/radicale/__init__.py index 1216d7a..806ddef 100644 --- a/radicale/__init__.py +++ b/radicale/__init__.py @@ -57,6 +57,8 @@ VERSION = "0.9" # tries to access information they don't have rights to NOT_ALLOWED = (client.FORBIDDEN, {}, None) +WELL_KNOWN_RE = re.compile(r"/.well-known/(carddav|caldav)/?") + class HTTPServer(wsgiref.simple_server.WSGIServer, object): """HTTP server.""" @@ -277,7 +279,7 @@ class Application(object): user = environ.get("REMOTE_USER") password = None - well_known = re.compile(r"/.well-known/(carddav|caldav)/?").match(path) + well_known = WELL_KNOWN_RE.match(path) if well_known: redirect = config.get("well-known", well_known.group(1)) try: