OLD | NEW |
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 caching_rietveld_patcher import CachingRietveldPatcher | 10 from caching_rietveld_patcher import CachingRietveldPatcher |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 branch_utility, | 64 branch_utility, |
65 patched_host_file_system_provider, | 65 patched_host_file_system_provider, |
66 self._delegate.CreateGithubFileSystemProvider(object_store_creator), | 66 self._delegate.CreateGithubFileSystemProvider(object_store_creator), |
67 CloudStorageFileSystemProvider(object_store_creator), | 67 CloudStorageFileSystemProvider(object_store_creator), |
68 base_path='/_patch/%s/' % self._issue) | 68 base_path='/_patch/%s/' % self._issue) |
69 | 69 |
70 # HACK: if content_providers.json changes in this patch then the cron needs | 70 # HACK: if content_providers.json changes in this patch then the cron needs |
71 # to be re-run to pull in the new configuration. | 71 # to be re-run to pull in the new configuration. |
72 _, _, modified = rietveld_patcher.GetPatchedFiles() | 72 _, _, modified = rietveld_patcher.GetPatchedFiles() |
73 if CONTENT_PROVIDERS in modified: | 73 if CONTENT_PROVIDERS in modified: |
74 server_instance.content_providers.Cron().Get() | 74 server_instance.content_providers.Refresh().Get() |
75 | 75 |
76 return server_instance | 76 return server_instance |
77 | 77 |
78 class PatchServlet(Servlet): | 78 class PatchServlet(Servlet): |
79 '''Servlet which renders patched docs. | 79 '''Servlet which renders patched docs. |
80 ''' | 80 ''' |
81 def __init__(self, request, delegate=None): | 81 def __init__(self, request, delegate=None): |
82 self._request = request | 82 self._request = request |
83 self._delegate = delegate or InstanceServlet.Delegate() | 83 self._delegate = delegate or InstanceServlet.Delegate() |
84 | 84 |
(...skipping 24 matching lines...) Expand all Loading... |
109 # Disable cache for patched content. | 109 # Disable cache for patched content. |
110 response.headers.pop('cache-control', None) | 110 response.headers.pop('cache-control', None) |
111 except RietveldPatcherError as e: | 111 except RietveldPatcherError as e: |
112 response = Response.NotFound(e.message, {'Content-Type': 'text/plain'}) | 112 response = Response.NotFound(e.message, {'Content-Type': 'text/plain'}) |
113 | 113 |
114 redirect_url, permanent = response.GetRedirect() | 114 redirect_url, permanent = response.GetRedirect() |
115 if redirect_url is not None: | 115 if redirect_url is not None: |
116 response = Response.Redirect('/_patch/%s%s' % (issue, redirect_url), | 116 response = Response.Redirect('/_patch/%s%s' % (issue, redirect_url), |
117 permanent) | 117 permanent) |
118 return response | 118 return response |
OLD | NEW |