From python-checkins at python.org Sat Jun 19 17:43:23 2010 From: python-checkins at python.org (martin.von.loewis) Date: Sat, 19 Jun 2010 17:43:23 +0200 (CEST) Subject: [Pypi-checkins] r764 - trunk/pypi Message-ID: <20100619154323.EC1B9EE9BE@mail.python.org> Author: martin.von.loewis Date: Sat Jun 19 17:43:23 2010 New Revision: 764 Modified: trunk/pypi/config.py trunk/pypi/webui.py Log: For https, make pypi links https also, and switch to local resources. Modified: trunk/pypi/config.py ============================================================================== --- trunk/pypi/config.py (original) +++ trunk/pypi/config.py Sat Jun 19 17:43:23 2010 @@ -22,7 +22,7 @@ self.adminemail = c.get('webui', 'adminemail') self.replyto = c.get('webui', 'replyto') self.url = c.get('webui', 'url') - self.pydotorg = c.get('webui', 'pydotorg') + self.orig_pydotorg = self.pydotorg = c.get('webui', 'pydotorg') self.simple_script = c.get('webui', 'simple_script') self.files_url = c.get('webui', 'files_url') self.rss_file = c.get('webui', 'rss_file') @@ -40,3 +40,12 @@ self.fromaddr = c.get('logging', 'fromaddr') self.toaddrs = c.get('logging', 'toaddrs').split(',') + def make_https(self): + if self.url.startswith("http:"): + self.url = "https"+self.url[4:] + self.pydotorg = '/' + + def make_http(self): + if self.url.startswith("https:"): + self.url = "http"+self.url[5:] + self.pydotorg = self.orig_pydotorg Modified: trunk/pypi/webui.py ============================================================================== --- trunk/pypi/webui.py (original) +++ trunk/pypi/webui.py Sat Jun 19 17:43:23 2010 @@ -107,7 +107,7 @@ chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' -providers = (('Google', 'http://www.google.com/favicon.ico', 'https://www.google.com/accounts/o8/id'), +providers = (('Google', 'https://www.google.com/favicon.ico', 'https://www.google.com/accounts/o8/id'), ('myOpenID', 'https://www.myopenid.com/favicon.ico', 'https://www.myopenid.com/'), ('Launchpad', 'https://launchpad.net/@@/launchpad.png', 'https://login.launchpad.net/') ) @@ -231,6 +231,11 @@ else: self.form = None + if env.get("HTTPS") == 'on': + self.config.make_https() + else: + self.config.make_http() + (protocol, machine, path, x, x, x) = urlparse.urlparse(self.config.url) self.url_machine = '%s://%s'%(protocol, machine) self.url_path = path