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

Side by Side Diff: chrome/common/extensions/docs/server2/handler.py

Issue 10826173: Extensions Docs Server: Proper path handling (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
OLDNEW
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 import sys 7 import sys
8 8
9 from appengine_wrappers import webapp 9 from appengine_wrappers import webapp
10 from appengine_wrappers import memcache 10 from appengine_wrappers import memcache
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 # TODO: This leaks Server instances when branch bumps. 121 # TODO: This leaks Server instances when branch bumps.
122 _GetInstanceForBranch(branch, self._local_path).Get(real_path, 122 _GetInstanceForBranch(branch, self._local_path).Get(real_path,
123 self.request, 123 self.request,
124 self.response) 124 self.response)
125 125
126 def get(self): 126 def get(self):
127 path = self.request.path 127 path = self.request.path
128 if '_ah/warmup' in path: 128 if '_ah/warmup' in path:
129 logging.info('Warmup request.') 129 logging.info('Warmup request.')
130 if DEFAULT_BRANCH != 'local': 130 if DEFAULT_BRANCH != 'local':
131 self._NavigateToPath('extensions/trunk/samples.html') 131 self._NavigateToPath('trunk/extensions/samples.html')
132 self._NavigateToPath('extensions/dev/samples.html') 132 self._NavigateToPath('dev/extensions/samples.html')
133 self._NavigateToPath('extensions/beta/samples.html') 133 self._NavigateToPath('beta/extensions/samples.html')
134 self._NavigateToPath('extensions/stable/samples.html') 134 self._NavigateToPath('stable/extensions/samples.html')
135 return 135 return
136 136
137 # Redirect paths like "directory" to "directory/". This is so relative file 137 # Redirect paths like "directory" to "directory/". This is so relative file
138 # paths will know to treat this as a directory. 138 # paths will know to treat this as a directory.
139 if os.path.splitext(path)[1] == '' and path[-1] != '/': 139 if os.path.splitext(path)[1] == '' and path[-1] != '/':
140 self.redirect(path + '/') 140 self.redirect(path + '/')
141 path = path.replace('/chrome/', '') 141 path = path.replace('/chrome/', '')
142 path = path.strip('/') 142 path = path.strip('/')
143 self._NavigateToPath(path) 143 self._NavigateToPath(path)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698