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

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

Issue 453713002: Docserver: Generate a table of extension/app API owners (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/docs/server2/compiled_file_system.py
diff --git a/chrome/common/extensions/docs/server2/compiled_file_system.py b/chrome/common/extensions/docs/server2/compiled_file_system.py
index 58ab967240dd191cd3200c8cc9cbde0bf4ae9182..c47f377e74d72355f9f91544dc3eb5ef6d1d1351 100644
--- a/chrome/common/extensions/docs/server2/compiled_file_system.py
+++ b/chrome/common/extensions/docs/server2/compiled_file_system.py
@@ -185,18 +185,22 @@ class CompiledFileSystem(object):
return self._file_system.Read(add_prefix(path, first_layer_dirs)).Then(
lambda results: first_layer_files + get_from_future_listing(results))
- def GetFromFile(self, path):
+ def GetFromFile(self, path, skip_not_found=False):
'''Calls |compilation_function| on the contents of the file at |path|. If
|binary| is True then the file will be read as binary - but this will only
apply for the first time the file is fetched; if already cached, |binary|
- will be ignored.
+ will be ignored. If |skip_not_found| is True, then if the file is not found
+ None is passed to |compilation_function|.
'''
AssertIsFile(path)
try:
version = self._file_system.Stat(path).version
except FileNotFoundError:
- return Future(exc_info=sys.exc_info())
+ if skip_not_found:
+ version = None
+ else:
+ return Future(exc_info=sys.exc_info())
cache_entry = self._file_object_store.Get(path).Get()
if (cache_entry is not None) and (version == cache_entry.version):
@@ -206,7 +210,7 @@ class CompiledFileSystem(object):
cache_data = self._compilation_function(path, files)
self._file_object_store.Set(path, _CacheEntry(cache_data, version))
return cache_data
- return self._file_system.ReadSingle(path).Then(next)
+ return self._file_system.ReadSingle(path, skip_not_found).Then(next)
not at google - send to devlin 2014/08/21 21:39:58 skip_not_found=skip_not_found
def GetFromFileListing(self, path):
'''Calls |compilation_function| on the listing of the files at |path|.

Powered by Google App Engine
This is Rietveld 408576698