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

Unified Diff: chrome/common/extensions/docs/server2/handler.py

Issue 14125010: Docserver: Add support for viewing docs with a codereview patch applied (Closed) Base URL: https://src.chromium.org/svn/trunk/src/
Patch Set: Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/docs/server2/handler.py
===================================================================
--- chrome/common/extensions/docs/server2/handler.py (revision 196612)
+++ chrome/common/extensions/docs/server2/handler.py (working copy)
@@ -10,6 +10,7 @@
from appengine_wrappers import (
DeadlineExceededError, IsDevServer, logservice, memcache, urlfetch, webapp)
from branch_utility import BranchUtility
+from rietveld_utility import RietveldUtility
from server_instance import ServerInstance
import svn_constants
import time
@@ -40,7 +41,10 @@
super(Handler, self).__init__(request, response)
def _HandleGet(self, path):
- channel_name, real_path = BranchUtility.SplitChannelNameFromPath(path)
+ channel_name, issue, real_path = (
not at google - send to devlin 2013/04/26 23:53:53 We only need to support 'trunk' here. Note for fut
方觉(Fang Jue) 2013/04/27 00:24:34 Yes. I know that. And SplitPatchFromPath will alwa
not at google - send to devlin 2013/04/27 00:45:30 Yep, as in when you pull this into its own servlet
+ RietveldUtility.SplitPatchFromPath(path))
+ if issue is None:
+ channel_name, real_path = BranchUtility.SplitChannelNameFromPath(path)
not at google - send to devlin 2013/04/26 23:53:53 I've just written https://codereview.chromium.org/
方觉(Fang Jue) 2013/04/27 00:24:34 I did take a look at it just now before I had brea
if channel_name == _DEFAULT_CHANNEL:
self.redirect('/%s' % real_path)
@@ -56,10 +60,12 @@
if real_path.strip('/') == 'extensions':
real_path = 'extensions/index.html'
- constructor = (
- ServerInstance.CreateOnline if Handler.ALWAYS_ONLINE else
- ServerInstance.GetOrCreateOffline)
- server_instance = constructor(channel_name)
+ # Serving patched content requires an online server instance to fetch
+ # data from SVN and Rietveld.
+ if Handler.ALWAYS_ONLINE or issue is not None:
+ server_instance = ServerInstance.CreateOnline(channel_name, issue)
+ else:
+ server_instance = ServerInstance.GetOrCreateOffline(channel_name)
canonical_path = server_instance.path_canonicalizer.Canonicalize(real_path)
if real_path != canonical_path:

Powered by Google App Engine
This is Rietveld 408576698