diff options
author | fangjue23303@gmail.com <fangjue23303@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-03 01:49:26 +0000 |
---|---|---|
committer | fangjue23303@gmail.com <fangjue23303@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-03 01:49:26 +0000 |
commit | d1ca2166054258c881ebd087b294f7e55e514a58 (patch) | |
tree | 51076441a437a450d2f621718fbc990b4f39f9b8 | |
parent | 4250c31cf1c6db7bf31083445de6d450e5c90358 (diff) | |
download | chromium_src-d1ca2166054258c881ebd087b294f7e55e514a58.zip chromium_src-d1ca2166054258c881ebd087b294f7e55e514a58.tar.gz chromium_src-d1ca2166054258c881ebd087b294f7e55e514a58.tar.bz2 |
Docserver: Fix broken _patch thing.
It's broken and results in 404 Not Found or 500 Server Error in some
cases (for example,
https://chromiumcodereview.appspot.com/19763008/#ps8001 (patchset 4
resulted in 404 and later patchsets resulted in 500)
and https://chromiumcodereview.appspot.com/18857002/ (500 Server Error) ).
R=kalman@chromium.org
BUG=234022
NOTRY=TRUE
Review URL: https://chromiumcodereview.appspot.com/21523003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@215448 0039d316-1c4b-4281-b951-d872f2087c98
6 files changed, 13 insertions, 11 deletions
diff --git a/chrome/common/extensions/docs/server2/app.yaml b/chrome/common/extensions/docs/server2/app.yaml index 58ae227..460c490c 100644 --- a/chrome/common/extensions/docs/server2/app.yaml +++ b/chrome/common/extensions/docs/server2/app.yaml @@ -1,5 +1,5 @@ application: chrome-apps-doc -version: 2-15-0 +version: 2-15-1 runtime: python27 api_version: 1 threadsafe: false diff --git a/chrome/common/extensions/docs/server2/branch_utility.py b/chrome/common/extensions/docs/server2/branch_utility.py index 85e77e5..d449263 100644 --- a/chrome/common/extensions/docs/server2/branch_utility.py +++ b/chrome/common/extensions/docs/server2/branch_utility.py @@ -129,7 +129,7 @@ class BranchUtility(object): if version == 'trunk': return 'trunk' - branch = self._branch_object_store.Get(version).Get() + branch = self._branch_object_store.Get(str(version)).Get() if branch is not None: return branch diff --git a/chrome/common/extensions/docs/server2/cron.yaml b/chrome/common/extensions/docs/server2/cron.yaml index 79fa0a5..1e33613 100644 --- a/chrome/common/extensions/docs/server2/cron.yaml +++ b/chrome/common/extensions/docs/server2/cron.yaml @@ -2,4 +2,4 @@ cron: - description: Repopulates all cached data. url: /_cron schedule: every 5 minutes - target: 2-15-0 + target: 2-15-1 diff --git a/chrome/common/extensions/docs/server2/host_file_system_creator.py b/chrome/common/extensions/docs/server2/host_file_system_creator.py index 381e664..956ce30 100644 --- a/chrome/common/extensions/docs/server2/host_file_system_creator.py +++ b/chrome/common/extensions/docs/server2/host_file_system_creator.py @@ -23,7 +23,7 @@ class HostFileSystemCreator(object): # Provides custom create behavior, useful in tests. self._constructor_for_test = constructor_for_test - def Create(self, branch='trunk', revision=None): + def Create(self, branch='trunk', revision=None, offline=None): '''Creates either SVN file systems or specialized file systems from the constructor passed into this instance. Wraps the resulting file system in an Offline file system if the offline flag is set, and finally wraps it in a @@ -34,7 +34,7 @@ class HostFileSystemCreator(object): else: file_system = SubversionFileSystem.Create(branch=branch, revision=revision) - if self._offline: + if offline or (offline is None and self._offline): file_system = OfflineFileSystem(file_system) return CachingFileSystem(file_system, self._object_store_creator) diff --git a/chrome/common/extensions/docs/server2/patch_servlet.py b/chrome/common/extensions/docs/server2/patch_servlet.py index 8207e1d..a394a17 100644 --- a/chrome/common/extensions/docs/server2/patch_servlet.py +++ b/chrome/common/extensions/docs/server2/patch_servlet.py @@ -33,10 +33,12 @@ class _PatchServletDelegate(RenderServlet.Delegate): branch_utility = self._delegate.CreateBranchUtility(object_store_creator) host_file_system_creator = self._delegate.CreateHostFileSystemCreator( object_store_creator) - # TODO(fj): Use OfflineFileSystem here once all json/idl files in api/ - # are pulled into data store by cron jobs. - base_file_system = CachingFileSystem(host_file_system_creator.Create(), - object_store_creator) + # offline=False because a patch can rely on files that are already in SVN + # repository but not yet pulled into data store by cron jobs (a typical + # example is to add documentation for an existing API). + base_file_system = CachingFileSystem( + host_file_system_creator.Create(offline=False), + object_store_creator) base_compiled_fs_factory = CompiledFileSystem.Factory(base_file_system, object_store_creator) diff --git a/chrome/common/extensions/docs/server2/redirector_test.py b/chrome/common/extensions/docs/server2/redirector_test.py index 713d6e41..0c2bdb4 100755 --- a/chrome/common/extensions/docs/server2/redirector_test.py +++ b/chrome/common/extensions/docs/server2/redirector_test.py @@ -73,8 +73,8 @@ class RedirectorTest(unittest.TestCase): '/index.html', redirector.Redirect(HOST, 'apps/')) def testNotFound(self): - self.assertIsNone(redirector.Redirect(HOST, 'not/a/real/path')) - self.assertIsNone(redirector.Redirect(HOST, 'public/apps/okay.html')) + self.assertEqual(None, redirector.Redirect(HOST, 'not/a/real/path')) + self.assertEqual(None, redirector.Redirect(HOST, 'public/apps/okay.html')) def testOldHosts(self): self.assertEqual( |