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

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: rebased with master 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 | « chrome/common/extensions/docs/server/app.yaml ('k') | 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 newUrl = CHROME_DOMAIN_URL
178 # switch to https if necessary
179 if (self.request.url.startswith('https')):
180 newUrl = newUrl.replace('http', 'https', 1)
176 self.path.pop(0) # 'chrome' 181 self.path.pop(0) # 'chrome'
177 for channel in ['dev', 'beta', 'stable', 'trunk']: 182 for channel in ['dev', 'beta', 'stable', 'trunk']:
178 if channel in self.path: 183 if channel in self.path:
179 position = self.path.index(channel) 184 position = self.path.index(channel)
180 self.path.pop(position) 185 self.path.pop(position)
181 self.path.insert(0, channel) 186 self.path.insert(0, channel)
182 self.redirect(CHROME_DOMAIN_URL + '/' + '/'.join(self.path), True) 187 self.redirect(newUrl + '/' + '/'.join(self.path), True)
183 return False 188 return False
184 else: 189 else:
185 return True 190 return True
186 191
187 192
188 def fetchContent(self): 193 def fetchContent(self):
189 logging.info("fetching: %s" % str((self.branch, self.docFamily, self.path))) 194 logging.info("fetching: %s" % str((self.branch, self.docFamily, self.path)))
190 195
191 # For extensions, try the old directory layout first. 196 # For extensions, try the old directory layout first.
192 result = None 197 result = None
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 ('/.*', MainPage), 248 ('/.*', MainPage),
244 ], debug=False) 249 ], debug=False)
245 250
246 251
247 def main(): 252 def main():
248 run_wsgi_app(application) 253 run_wsgi_app(application)
249 254
250 255
251 if __name__ == '__main__': 256 if __name__ == '__main__':
252 main() 257 main()
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/server/app.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698