Chromium Code Reviews| 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..2f5bfda6a7de114187e5ef9ef94437bf118b13d7 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, file_system, patcher): |
| + self._file_system = file_system |
|
Jeffrey Yasskin
2013/10/08 17:46:05
I think I'd rather "base_file_system", since it's
not at google - send to devlin
2013/10/08 18:27:37
Good point. "Base" is a useful prefix. "Host" mean
|
| 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._file_system.Read(unpatched_paths, binary), |
| + self._patcher.Apply(patched_paths, self._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._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._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._file_system.Stat will throw an exception. |
| try: |
| stat_info = self._PatchStat( |
| - self._host_file_system.Stat(directory + '/'), |
| + self._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._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._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._file_system.GetIdentity(), |
| self._patcher.GetIdentity()) |