OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import cgi | 6 import cgi |
7 import logging | 7 import logging |
8 import os | 8 import os |
9 import re | 9 import re |
10 | 10 |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
165 | 165 |
166 def initDocFamily(self): | 166 def initDocFamily(self): |
167 if self.path[0] in ('extensions', 'apps'): | 167 if self.path[0] in ('extensions', 'apps'): |
168 self.docFamily = self.path.pop(0) | 168 self.docFamily = self.path.pop(0) |
169 else: | 169 else: |
170 self.docFamily = 'extensions' | 170 self.docFamily = 'extensions' |
171 return self.redirectToIndexIfNecessary() | 171 return self.redirectToIndexIfNecessary() |
172 | 172 |
173 | 173 |
174 def redirectDomain(self): | 174 def redirectDomain(self): |
175 if (self.request.url.startswith('http://code.google.com')): | 175 if (self.request.url.startswith(('http://code.google.com', |
176 'https://code.google.com'))): | |
177 # switch to https if necessary | |
178 if (self.request.url.startswith('https'): | |
179 CHROME_DOMAIN_URL.replace('http', 'https', 1) | |
Aaron Boodman
2012/08/15 00:15:29
You need to store the result in a variable. Someth
| |
176 self.path.pop(0) # 'chrome' | 180 self.path.pop(0) # 'chrome' |
177 for channel in ['dev', 'beta', 'stable', 'trunk']: | 181 for channel in ['dev', 'beta', 'stable', 'trunk']: |
178 if channel in self.path: | 182 if channel in self.path: |
179 position = self.path.index(channel) | 183 position = self.path.index(channel) |
180 self.path.pop(position) | 184 self.path.pop(position) |
181 self.path.insert(0, channel) | 185 self.path.insert(0, channel) |
182 self.redirect(CHROME_DOMAIN_URL + '/' + '/'.join(self.path), True) | 186 self.redirect(CHROME_DOMAIN_URL + '/' + '/'.join(self.path), True) |
183 return False | 187 return False |
184 else: | 188 else: |
185 return True | 189 return True |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
243 ('/.*', MainPage), | 247 ('/.*', MainPage), |
244 ], debug=False) | 248 ], debug=False) |
245 | 249 |
246 | 250 |
247 def main(): | 251 def main(): |
248 run_wsgi_app(application) | 252 run_wsgi_app(application) |
249 | 253 |
250 | 254 |
251 if __name__ == '__main__': | 255 if __name__ == '__main__': |
252 main() | 256 main() |
OLD | NEW |