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

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

Issue 474293007: Docserver: Automatically implement FileSystem.Stat if FileSystem.StatAsync has (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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/file_system.py
diff --git a/chrome/common/extensions/docs/server2/file_system.py b/chrome/common/extensions/docs/server2/file_system.py
index 1e5b567dab59b3b1eea7229f2416ac8695fab1e2..e459e1207c155e63101944bd429ad54ef6b3299c 100644
--- a/chrome/common/extensions/docs/server2/file_system.py
+++ b/chrome/common/extensions/docs/server2/file_system.py
@@ -121,18 +121,27 @@ class FileSystem(object):
# TODO(cduvall): Allow Stat to take a list of paths like Read.
def Stat(self, path):
- '''Returns a |StatInfo| object containing the version of |path|. If |path|
+ '''DEPRECATED: Please try to use StatAsync instead.
+
+ Returns a |StatInfo| object containing the version of |path|. If |path|
is a directory, |StatInfo| will have the versions of all the children of
the directory in |StatInfo.child_versions|.
If the path cannot be found, raises a FileNotFoundError.
For any other failure, raises a FileSystemError.
'''
+ # Delegate to this implementation's StatAsync if it has been implemented.
+ if type(self).StatAsync != FileSystem.StatAsync:
+ return self.StatAsync(path).Get()
raise NotImplementedError(self.__class__)
def StatAsync(self, path):
- '''Bandaid for a lack of an async Stat function. Stat() should be async
- by default but for now just let implementations override this if they like.
+ '''An async version of Stat. Returns a Future to a StatInfo rather than a
+ raw StatInfo.
+
+ This is a bandaid for a lack of an async Stat function. Stat() should be
+ async by default but for now just let implementations override this if they
+ like.
'''
return Future(callback=lambda: self.Stat(path))

Powered by Google App Engine
This is Rietveld 408576698