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

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

Issue 61393002: Docserver: Enable GitHub content providers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 1 month 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 8b6314dc07971f96df47525b134692d25d58a793..7851b6066d2b807711d2dc4eac9c78b879644130 100644
--- a/chrome/common/extensions/docs/server2/file_system.py
+++ b/chrome/common/extensions/docs/server2/file_system.py
@@ -11,6 +11,7 @@ class FileNotFoundError(Exception):
def __init__(self, filename):
Exception.__init__(self, filename)
+
class FileSystemError(Exception):
'''Raised on when there are errors reading or statting files, such as a
network timeout.
@@ -18,6 +19,7 @@ class FileSystemError(Exception):
def __init__(self, filename):
Exception.__init__(self, filename)
+
class StatInfo(object):
'''The result of calling Stat on a FileSystem.
'''
@@ -40,6 +42,7 @@ class StatInfo(object):
def __repr__(self):
return str(self)
+
def ToUnicode(data):
'''Returns the str |data| as a unicode object. It's expected to be utf8, but
there are also latin-1 encodings in there for some reason. Fall back to that.
@@ -49,6 +52,7 @@ def ToUnicode(data):
except:
return unicode(data, 'latin-1')
+
class FileSystem(object):
'''A FileSystem interface that can read files and directories.
'''
@@ -76,7 +80,10 @@ class FileSystem(object):
return Future(delegate=Gettable(lambda: read_single.Get()[path]))
def Refresh(self):
- raise NotImplementedError(self.__class__)
+ '''Asynchronously refreshes the content of the FileSystem, returning a
+ future to its completion.
+ '''
+ return Future(value=())
# TODO(cduvall): Allow Stat to take a list of paths like Read.
def Stat(self, path):

Powered by Google App Engine
This is Rietveld 408576698