Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / chrome / common / extensions / docs / server2 / chroot_file_system.py
index 3bf1028..950aa39 100644 (file)
@@ -11,8 +11,8 @@ from future import Gettable, Future
 
 class ChrootFileSystem(FileSystem):
   '''ChrootFileSystem(fs, path) exposes a FileSystem whose root is |path| inside
-  |fs|, so ChrootFileSystem(fs, '/hello').Read(['/world']) is equivalent to
-  fs.Read(['/hello/world']) with the '/hello' prefix stripped from the result.
+  |fs|, so ChrootFileSystem(fs, 'hello').Read(['world']) is equivalent to
+  fs.Read(['hello/world']) with the 'hello' prefix stripped from the result.
   '''
 
   def __init__(self, file_system, root):
@@ -23,7 +23,7 @@ class ChrootFileSystem(FileSystem):
     self._file_system = file_system
     self._root = root.strip('/')
 
-  def Read(self, paths, binary=False):
+  def Read(self, paths):
     # Maintain reverse mapping so the result can be mapped to the original
     # paths given (the result from |file_system| will include |root| in the
     # result, which would be wrong).
@@ -33,15 +33,22 @@ class ChrootFileSystem(FileSystem):
       prefixed_paths[prefixed] = path
       return prefixed
     future_result = self._file_system.Read(
-        tuple(prefix(path) for path in paths), binary=binary)
+        tuple(prefix(path) for path in paths))
     def resolve():
       return dict((prefixed_paths[path], content)
                   for path, content in future_result.Get().iteritems())
     return Future(delegate=Gettable(resolve))
 
+  def Refresh(self):
+    return self._file_system.Refresh()
+
   def Stat(self, path):
     return self._file_system.Stat(posixpath.join(self._root, path))
 
   def GetIdentity(self):
     return StringIdentity(
         '%s/%s' % (self._file_system.GetIdentity(), self._root))
+
+  def __repr__(self):
+    return 'ChrootFileSystem(%s, %s)' % (
+            self._root, repr(self._file_system))