[CalendarServer-changes] [4630] CalendarServer/branches/users/wsanchez/deployment/twistedcaldav/ httpfactory.py

source_changes at macosforge.org source_changes at macosforge.org
Wed Oct 21 16:55:18 PDT 2009


Revision: 4630
          http://trac.macosforge.org/projects/calendarserver/changeset/4630
Author:   wsanchez at apple.com
Date:     2009-10-21 16:55:16 -0700 (Wed, 21 Oct 2009)
Log Message:
-----------
Fix up retryAfter logic

Modified Paths:
--------------
    CalendarServer/branches/users/wsanchez/deployment/twistedcaldav/httpfactory.py

Modified: CalendarServer/branches/users/wsanchez/deployment/twistedcaldav/httpfactory.py
===================================================================
--- CalendarServer/branches/users/wsanchez/deployment/twistedcaldav/httpfactory.py	2009-10-21 23:42:51 UTC (rev 4629)
+++ CalendarServer/branches/users/wsanchez/deployment/twistedcaldav/httpfactory.py	2009-10-21 23:55:16 UTC (rev 4630)
@@ -34,19 +34,21 @@
 
         if config.HTTPRetryAfter:
             retryAfter = randint(int(config.HTTPRetryAfter * 1/2), int(config.HTTPRetryAfter * 3/2))
-            headers = { "retryAfter": retryAfter }
+            retryAfter = "Retry-After: %s\r\n" % retryAfter
         else:
-            headers = {}
+            retryAfter = ""
 
-        self.transport.write("HTTP/1.0 503 Service Unavailable\r\n"
-                             "Content-Type: text/html\r\n"
-                             "Retry-After: %(retryAfter)s\r\n"
-                             "Connection: close\r\n\r\n"
-                             "<html><head><title>503 Service Unavailable</title></head>"
-                             "<body><h1>Service Unavailable</h1>"
-                             "The server is currently overloaded, "
-                             "please try again later.</body></html>"
-                             % headers)
+        self.transport.write(
+            "HTTP/1.0 503 Service Unavailable\r\n"
+            "Content-Type: text/html\r\n"
+            "%(retryAfter)s"
+            "Connection: close\r\n\r\n"
+            "<html><head><title>503 Service Unavailable</title></head>"
+            "<body><h1>Service Unavailable</h1>"
+            "The server is currently overloaded, "
+            "please try again later.</body></html>"
+            % { "retryAfter": retryAfter }
+        )
 
         self.transport.loseConnection()
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20091021/52d1e71e/attachment-0001.html>


More information about the calendarserver-changes mailing list