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

Side by Side Diff: chrome/common/extensions/docs/server2/offline_file_system.py

Issue 13896007: Devserver: run the cron over the examples. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: try again to avoid .svn 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 from file_system import FileSystem, FileNotFoundError 5 from file_system import FileSystem, FileNotFoundError
6 6
7 class OfflineFileSystem(FileSystem): 7 class OfflineFileSystem(FileSystem):
8 '''An offline FileSystem which masquerades as another file system. It throws 8 '''An offline FileSystem which masquerades as another file system. It throws
9 FileNotFound error for all operations, and overrides GetName and GetVersion. 9 FileNotFound error for all operations, and overrides GetName and GetVersion.
10 ''' 10 '''
11 def __init__(self, cls): 11 def __init__(self, cls):
12 self._cls = cls 12 self._cls = cls
13 13
14 def Read(self, paths, binary=False): 14 def Read(self, paths, binary=False):
15 raise FileNotFoundError(paths) 15 raise FileNotFoundError('File system is offline, cannot read %s' % paths)
16 16
17 def Stat(self, path): 17 def Stat(self, path):
18 raise FileNotFoundError(path) 18 raise FileNotFoundError('File system is offline, cannot read %s' % path)
19 19
20 # HACK: despite GetName/GetVersion being @classmethods, these need to be 20 # HACK: despite GetName/GetVersion being @classmethods, these need to be
21 # instance methods so that we can grab the name and version from the class 21 # instance methods so that we can grab the name and version from the class
22 # given on construction. 22 # given on construction.
23 23
24 def GetName(self): 24 def GetName(self):
25 return self._cls.GetName() 25 return self._cls.GetName()
26 26
27 def GetVersion(self): 27 def GetVersion(self):
28 return self._cls.GetVersion() 28 return self._cls.GetVersion()
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/server2/local_file_system.py ('k') | chrome/common/extensions/docs/server2/server_instance.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698