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

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

Issue 151883009: Docserver: Make MockFileSystem not iterate over the entire file system as part (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: yoz and then some Created 6 years, 10 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/empty_dir_file_system.py
diff --git a/chrome/common/extensions/docs/server2/empty_dir_file_system.py b/chrome/common/extensions/docs/server2/empty_dir_file_system.py
index 58053a80f57f50e8413797ff8d1ccdcd0cc6ce3c..24a5a26fe32c5642fbaf56dd825828c4f9171080 100644
--- a/chrome/common/extensions/docs/server2/empty_dir_file_system.py
+++ b/chrome/common/extensions/docs/server2/empty_dir_file_system.py
@@ -4,6 +4,8 @@
from file_system import FileNotFoundError, FileSystem, StatInfo
from future import Future
+from path_util import IsDirectory
+
class EmptyDirFileSystem(FileSystem):
'''A FileSystem with empty directories. Useful to inject places to disable
@@ -12,7 +14,7 @@ class EmptyDirFileSystem(FileSystem):
def Read(self, paths):
result = {}
for path in paths:
- if not path.endswith('/'):
+ if not IsDirectory(path):
raise FileNotFoundError('EmptyDirFileSystem cannot read %s' % path)
result[path] = []
return Future(value=result)
@@ -21,7 +23,7 @@ class EmptyDirFileSystem(FileSystem):
return Future(value=())
def Stat(self, path):
- if not path.endswith('/'):
+ if not IsDirectory(path):
raise FileNotFoundError('EmptyDirFileSystem cannot stat %s' % path)
return StatInfo(0, child_versions=[])

Powered by Google App Engine
This is Rietveld 408576698