[Pypi-checkins] r1005 - trunk/pypi

martin.von.loewis python-checkins at python.org
Sun Jan 1 18:55:35 CET 2012


Author: martin.von.loewis
Date: Sun Jan  1 18:55:34 2012
New Revision: 1005

Modified:
   trunk/pypi/webui.py
Log:
Add X-XRDS-Location header to /pypi.


Modified: trunk/pypi/webui.py
==============================================================================
--- trunk/pypi/webui.py	(original)
+++ trunk/pypi/webui.py	Sun Jan  1 18:55:34 2012
@@ -333,7 +333,7 @@
     error_message = None
     ok_message = None
 
-    def write_template(self, filename, **options):
+    def write_template(self, filename, headers={}, **options):
         context = {}
         options.setdefault('norobots', False)
         options.setdefault('keywords', 'python programming language object'
@@ -384,6 +384,8 @@
         if self.usercookie:
             self.handler.send_header('Set-Cookie',
                                      'pypi='+self.usercookie+';path='+self.url_path)
+        for k,v in headers.items():
+            self.handler.send_header(k, v)
         self.handler.end_headers()
         self.wfile.write(content.encode('utf-8'))
 
@@ -721,7 +723,8 @@
             return self.openid_user(path)
 
     def home(self, nav_current='home'):
-        self.write_template('home.pt', title='PyPI - the Python Package Index')
+        self.write_template('home.pt', title='PyPI - the Python Package Index',
+                            headers={'X-XRDS-Location':self.url_machine+'/id'})
 
     def about(self, nav_current='home'):
         self.write_template('about.pt', title='About PyPI')


More information about the Pypi-checkins mailing list