| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import logging | 5 import logging |
| 6 import os | 6 import os |
| 7 from StringIO import StringIO | 7 from StringIO import StringIO |
| 8 import time |
| 8 | 9 |
| 9 from appengine_wrappers import webapp | 10 from appengine_wrappers import webapp |
| 10 from appengine_wrappers import memcache | 11 from appengine_wrappers import memcache |
| 11 from appengine_wrappers import urlfetch | 12 from appengine_wrappers import urlfetch |
| 12 from branch_utility import BranchUtility | 13 from branch_utility import BranchUtility |
| 13 from server_instance import ServerInstance | 14 from server_instance import ServerInstance |
| 14 import svn_constants | 15 import svn_constants |
| 15 import time | |
| 16 | 16 |
| 17 # The default channel to serve docs for if no channel is specified. | 17 # The default channel to serve docs for if no channel is specified. |
| 18 _DEFAULT_CHANNEL = 'stable' | 18 _DEFAULT_CHANNEL = 'stable' |
| 19 | 19 |
| 20 class Handler(webapp.RequestHandler): | 20 class Handler(webapp.RequestHandler): |
| 21 def __init__(self, request, response): | 21 def __init__(self, request, response): |
| 22 super(Handler, self).__init__(request, response) | 22 super(Handler, self).__init__(request, response) |
| 23 | 23 |
| 24 def _HandleGet(self, path): | 24 def _HandleGet(self, path): |
| 25 channel_name, real_path = BranchUtility.SplitChannelNameFromPath(path) | 25 channel_name, real_path = BranchUtility.SplitChannelNameFromPath(path) |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 # file paths will know to treat this as a directory. | 153 # file paths will know to treat this as a directory. |
| 154 if os.path.splitext(path)[1] == '' and path[-1] != '/': | 154 if os.path.splitext(path)[1] == '' and path[-1] != '/': |
| 155 self.redirect(path + '/') | 155 self.redirect(path + '/') |
| 156 return | 156 return |
| 157 | 157 |
| 158 path = path.strip('/') | 158 path = path.strip('/') |
| 159 if self._RedirectFromCodeDotGoogleDotCom(path): | 159 if self._RedirectFromCodeDotGoogleDotCom(path): |
| 160 return | 160 return |
| 161 | 161 |
| 162 self._HandleGet(path) | 162 self._HandleGet(path) |
| OLD | NEW |