Chromium Code Reviews| 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|. |