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 6c547ba2a2b9a9efc9f9faffc0692872f80b023a..fc0de26317bdc7a44cd2051b52773db6b48fd3d9 100644 |
--- a/chrome/common/extensions/docs/server2/compiled_file_system.py |
+++ b/chrome/common/extensions/docs/server2/compiled_file_system.py |
@@ -5,6 +5,7 @@ |
import os |
import object_store |
+import logging |
APPS = 'Apps' |
APPS_FS = 'AppsFileSystem' |
@@ -47,7 +48,8 @@ class CompiledFileSystem(object): |
"""Create a CompiledFileSystem that populates the cache by calling |
|populate_function| with (path, data), where |data| is the data that was |
fetched from |path|. The keys to the cache are put in the namespace |
- specified by |namespace|, and optionally adding |version|. """ |
+ specified by |namespace|, and optionally adding |version|. |
+ """ |
return CompiledFileSystem(self._file_system, |
populate_function, |
self._object_store, |
@@ -68,7 +70,7 @@ class CompiledFileSystem(object): |
self._namespace = '%s.%s' % (self._namespace, version) |
def _MakeKey(self, key): |
- return self._namespace + '.' + key |
+ return '%s.%s' % (self._namespace, key) |
def _RecursiveList(self, files): |
all_files = files[:] |
@@ -93,14 +95,19 @@ class CompiledFileSystem(object): |
time=0).Get() |
if (cache_entry is not None) and (version == cache_entry.version): |
return cache_entry._cache_data |
- cache_data = self._populate_function( |
- path, |
- self._file_system.ReadSingle(path, binary=binary)) |
- self._object_store.Set(self._MakeKey(path), |
- _CacheEntry(cache_data, version), |
- object_store.FILE_SYSTEM_CACHE, |
- time=0) |
- return cache_data |
+ try: |
+ cache_data = self._populate_function( |
+ path, |
+ self._file_system.ReadSingle(path, binary=binary)) |
+ self._object_store.Set(self._MakeKey(path), |
+ _CacheEntry(cache_data, version), |
+ object_store.FILE_SYSTEM_CACHE, |
+ time=0) |
+ return cache_data |
+ except ValueError: |
cduvall
2013/03/25 22:59:43
When will this ValueError happen?
epeterson
2013/03/27 22:36:09
This ValueError is raised in ApiListDataSource's .
|
+ return {} |
+ logging.error('Caught a ValueError while trying to get the contents of', |
cduvall
2013/03/25 22:59:43
This logging will never happen because its after t
epeterson
2013/03/27 22:36:09
Done. Oops..thought I fixed that.
|
+ ' the file at %s' % path) |
def GetFromFileListing(self, path): |
"""Calls |populate_function| on the listing of the files at |path|. |