[Pypi-checkins] r869 - trunk/pypi

martin.von.loewis python-checkins at python.org
Mon Sep 20 21:46:27 CEST 2010


Author: martin.von.loewis
Date: Mon Sep 20 21:46:27 2010
New Revision: 869

Modified:
   trunk/pypi/standalone.py
   trunk/pypi/webui.py
Log:
Add /daytime URL.


Modified: trunk/pypi/standalone.py
==============================================================================
--- trunk/pypi/standalone.py	(original)
+++ trunk/pypi/standalone.py	Mon Sep 20 21:46:27 2010
@@ -9,7 +9,7 @@
         self.send_header('Content-Type', content_type)
 
     def run(self):
-        for scriptname in ('/mirrors', '/simple', '/pypi', '/serversig'):
+        for scriptname in ('/mirrors', '/simple', '/pypi', '/serversig', '/daytime'):
             if self.path.startswith(scriptname):
                 rest = self.path[len(scriptname):]
                 break

Modified: trunk/pypi/webui.py
==============================================================================
--- trunk/pypi/webui.py	(original)
+++ trunk/pypi/webui.py	Mon Sep 20 21:46:27 2010
@@ -458,6 +458,8 @@
             return self.run_simple_sign()
         if script_name == '/mirrors':
             return self.mirrors()
+        if script_name == '/daytime':
+            return self.daytime()
         # see if the user has provided a username/password
         auth = self.env.get('HTTP_CGI_AUTHORIZATION', '').strip()
         if auth:
@@ -2749,6 +2751,16 @@
         options = {'title': 'PyPI mirrors'}
         self.write_template('mirrors.pt', **options)
 
+    def daytime(self):
+        # Mirrors are supposed to provide /last-modified,
+        # but it doesn't make sense to do so for the master server
+        '''display the current server time.
+        '''
+        self.handler.send_response(200, 'OK')
+        self.handler.set_content_type('text/plain')
+        self.handler.end_headers()
+        self.wfile.write(time.strftime("%Y%m%dT%H:%M:%S\n", time.gmtime(time.time())))
+
     def openid(self):
         self.write_template('openid.pt', title='OpenID Login')
 


More information about the Pypi-checkins mailing list