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

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

Issue 14218004: Devserver: only populate data during cron jobs, meaning all data from instances (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix integration test Created 7 years, 8 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/offline_file_system.py
diff --git a/chrome/common/extensions/docs/server2/offline_file_system.py b/chrome/common/extensions/docs/server2/offline_file_system.py
new file mode 100644
index 0000000000000000000000000000000000000000..984bb2a5a0c469df085ad0af8fdca447bfd90400
--- /dev/null
+++ b/chrome/common/extensions/docs/server2/offline_file_system.py
@@ -0,0 +1,28 @@
+# Copyright 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+from file_system import FileSystem, FileNotFoundError
+
+class OfflineFileSystem(FileSystem):
+ '''An offline FileSystem which masquerades as another file system. It throws
+ FileNotFound error for all operations, and overrides GetName and GetVersion.
+ '''
+ def __init__(self, cls):
+ self._cls = cls
+
+ def Read(self, paths, binary=False):
+ raise FileNotFoundError(paths)
+
+ def Stat(self, path):
+ raise FileNotFoundError(path)
+
+ # HACK: despite GetName/GetVersion being @classmethods, these need to be
+ # instance methods so that we can grab the name and version from the class
+ # given on construction.
+
+ def GetName(self):
+ return self._cls.GetName()
+
+ def GetVersion(self):
+ return self._cls.GetVersion()

Powered by Google App Engine
This is Rietveld 408576698