| Index: chrome/common/extensions/docs/server2/patched_file_system.py
|
| diff --git a/chrome/common/extensions/docs/server2/patched_file_system.py b/chrome/common/extensions/docs/server2/patched_file_system.py
|
| index c287c58f8e7c144d485df38e0997dd0e23c51ebd..39b52298778efae78c066b6138b07e52e8b6030f 100644
|
| --- a/chrome/common/extensions/docs/server2/patched_file_system.py
|
| +++ b/chrome/common/extensions/docs/server2/patched_file_system.py
|
| @@ -38,8 +38,8 @@ class _AsyncFetchFuture(object):
|
| class PatchedFileSystem(FileSystem):
|
| ''' Class to fetch resources with a patch applied.
|
| '''
|
| - def __init__(self, host_file_system, patcher):
|
| - self._host_file_system = host_file_system
|
| + def __init__(self, base_file_system, patcher):
|
| + self._base_file_system = base_file_system
|
| self._patcher = patcher
|
|
|
| def Read(self, paths, binary=False):
|
| @@ -53,13 +53,13 @@ class PatchedFileSystem(FileSystem):
|
| patched_paths = file_paths & patched_files
|
| unpatched_paths = file_paths - patched_files
|
| return Future(delegate=_AsyncFetchFuture(
|
| - self._host_file_system.Read(unpatched_paths, binary),
|
| - self._patcher.Apply(patched_paths, self._host_file_system, binary),
|
| + self._base_file_system.Read(unpatched_paths, binary),
|
| + self._patcher.Apply(patched_paths, self._base_file_system, binary),
|
| self._TryReadDirectory(dir_paths, binary),
|
| self))
|
|
|
| ''' Given the list of patched files, it's not possible to determine whether
|
| - a directory to read exists in self._host_file_system. So try reading each one
|
| + a directory to read exists in self._base_file_system. So try reading each one
|
| and handle FileNotFoundError.
|
| '''
|
| def _TryReadDirectory(self, paths, binary):
|
| @@ -67,7 +67,7 @@ class PatchedFileSystem(FileSystem):
|
| for path in paths:
|
| assert path.endswith('/')
|
| try:
|
| - value[path] = self._host_file_system.ReadSingle(path, binary)
|
| + value[path] = self._base_file_system.ReadSingle(path, binary)
|
| except FileNotFoundError:
|
| value[path] = None
|
| return value
|
| @@ -126,10 +126,10 @@ class PatchedFileSystem(FileSystem):
|
|
|
| if len(added) > 0:
|
| # There are new files added. It's possible (if |directory| is new) that
|
| - # self._host_file_system.Stat will throw an exception.
|
| + # self._base_file_system.Stat will throw an exception.
|
| try:
|
| stat_info = self._PatchStat(
|
| - self._host_file_system.Stat(directory + '/'),
|
| + self._base_file_system.Stat(directory + '/'),
|
| version,
|
| added,
|
| deleted,
|
| @@ -140,14 +140,14 @@ class PatchedFileSystem(FileSystem):
|
| dict((child, version) for child in added + modified))
|
| elif len(deleted) + len(modified) > 0:
|
| # No files were added.
|
| - stat_info = self._PatchStat(self._host_file_system.Stat(directory + '/'),
|
| + stat_info = self._PatchStat(self._base_file_system.Stat(directory + '/'),
|
| version,
|
| added,
|
| deleted,
|
| modified)
|
| else:
|
| # No changes are made in this directory.
|
| - return self._host_file_system.Stat(path)
|
| + return self._base_file_system.Stat(path)
|
|
|
| if stat_info.child_versions is not None:
|
| if filename:
|
| @@ -159,5 +159,5 @@ class PatchedFileSystem(FileSystem):
|
|
|
| def GetIdentity(self):
|
| return '%s(%s,%s)' % (self.__class__.__name__,
|
| - self._host_file_system.GetIdentity(),
|
| + self._base_file_system.GetIdentity(),
|
| self._patcher.GetIdentity())
|
|
|