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

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

Issue 26538009: Docserver: make file_system a property of Create (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: niggles Created 7 years, 2 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 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 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 from fnmatch import fnmatch 5 from fnmatch import fnmatch
6 import logging 6 import logging
7 from urlparse import urlparse 7 from urlparse import urlparse
8 8
9 from appengine_url_fetcher import AppEngineUrlFetcher 9 from appengine_url_fetcher import AppEngineUrlFetcher
10 from appengine_wrappers import IsDevServer 10 from appengine_wrappers import IsDevServer
(...skipping 16 matching lines...) Expand all
27 def __init__(self, issue, delegate): 27 def __init__(self, issue, delegate):
28 self._issue = issue 28 self._issue = issue
29 self._delegate = delegate 29 self._delegate = delegate
30 30
31 def CreateServerInstance(self): 31 def CreateServerInstance(self):
32 # start_empty=False because a patch can rely on files that are already in 32 # start_empty=False because a patch can rely on files that are already in
33 # SVN repository but not yet pulled into data store by cron jobs (a typical 33 # SVN repository but not yet pulled into data store by cron jobs (a typical
34 # example is to add documentation for an existing API). 34 # example is to add documentation for an existing API).
35 object_store_creator = ObjectStoreCreator(start_empty=False) 35 object_store_creator = ObjectStoreCreator(start_empty=False)
36 36
37 unpatched_host_file_system_provider = ( 37 unpatched_file_system = self._delegate.CreateHostFileSystemProvider(
38 self._delegate.CreateHostFileSystemProvider(object_store_creator)) 38 object_store_creator).GetTrunk()
39 unpatched_trunk_host_file_system = (
40 unpatched_host_file_system_provider.GetTrunk())
41 unpatched_compiled_fs_factory = CompiledFileSystem.Factory(
42 unpatched_trunk_host_file_system,
43 object_store_creator)
44 39
45 rietveld_patcher = CachingRietveldPatcher( 40 rietveld_patcher = CachingRietveldPatcher(
46 RietveldPatcher(svn_constants.EXTENSIONS_PATH, 41 RietveldPatcher(svn_constants.EXTENSIONS_PATH,
47 self._issue, 42 self._issue,
48 AppEngineUrlFetcher(url_constants.CODEREVIEW_SERVER)), 43 AppEngineUrlFetcher(url_constants.CODEREVIEW_SERVER)),
49 object_store_creator) 44 object_store_creator)
50 45
51 patched_file_system = PatchedFileSystem(unpatched_trunk_host_file_system, 46 patched_file_system = PatchedFileSystem(unpatched_file_system,
52 rietveld_patcher) 47 rietveld_patcher)
48
53 patched_host_file_system_provider = ( 49 patched_host_file_system_provider = (
54 self._delegate.CreateHostFileSystemProvider( 50 self._delegate.CreateHostFileSystemProvider(
55 object_store_creator, 51 object_store_creator,
56 # The patched file system needs to be online otherwise it'd be 52 # The patched file system needs to be online otherwise it'd be
57 # impossible to add files in the patches. 53 # impossible to add files in the patches.
58 offline=False, 54 offline=False,
59 # The trunk file system for this creator should be the patched one. 55 # The trunk file system for this creator should be the patched one.
60 default_trunk_instance=patched_file_system)) 56 default_trunk_instance=patched_file_system))
61 patched_compiled_fs_factory = CompiledFileSystem.Factory(
62 patched_file_system,
63 object_store_creator)
64 57
65 combined_compiled_fs_factory = ChainedCompiledFileSystem.Factory( 58 combined_compiled_fs_factory = ChainedCompiledFileSystem.Factory(
66 [(patched_compiled_fs_factory, patched_file_system), 59 [unpatched_file_system], object_store_creator)
67 (unpatched_compiled_fs_factory, unpatched_trunk_host_file_system)])
68 60
69 branch_utility = self._delegate.CreateBranchUtility(object_store_creator) 61 branch_utility = self._delegate.CreateBranchUtility(object_store_creator)
70 62
71 return ServerInstance(object_store_creator, 63 return ServerInstance(object_store_creator,
72 self._delegate.CreateAppSamplesFileSystem( 64 self._delegate.CreateAppSamplesFileSystem(
73 object_store_creator), 65 object_store_creator),
74 combined_compiled_fs_factory, 66 combined_compiled_fs_factory,
75 branch_utility, 67 branch_utility,
76 patched_host_file_system_provider, 68 patched_host_file_system_provider,
77 base_path='/_patch/%s/' % self._issue) 69 base_path='/_patch/%s/' % self._issue)
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 # Disable cache for patched content. 102 # Disable cache for patched content.
111 response.headers.pop('cache-control', None) 103 response.headers.pop('cache-control', None)
112 except RietveldPatcherError as e: 104 except RietveldPatcherError as e:
113 response = Response.NotFound(e.message, {'Content-Type': 'text/plain'}) 105 response = Response.NotFound(e.message, {'Content-Type': 'text/plain'})
114 106
115 redirect_url, permanent = response.GetRedirect() 107 redirect_url, permanent = response.GetRedirect()
116 if redirect_url is not None: 108 if redirect_url is not None:
117 response = Response.Redirect('/_patch/%s%s' % (issue, redirect_url), 109 response = Response.Redirect('/_patch/%s%s' % (issue, redirect_url),
118 permanent) 110 permanent)
119 return response 111 return response
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698