Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(791)

Side by Side Diff: chrome/common/extensions/docs/server/main.py

Issue 10823335: fixing https redirect from old codesite url (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698