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

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

Issue 10834329: Extension docs server: many changes to bring down the latency of the server, (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 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 import os 5 import os
6 6
7 import file_system 7 import file_system
8 from future import Future 8 from future import Future
9 9
10 class LocalFileSystem(file_system.FileSystem): 10 class LocalFileSystem(file_system.FileSystem):
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 else: 51 else:
52 result[path] = self._ReadFile(self._ConvertToFilepath(path), binary) 52 result[path] = self._ReadFile(self._ConvertToFilepath(path), binary)
53 return Future(value=result) 53 return Future(value=result)
54 54
55 def _CreateStatInfo(self, path): 55 def _CreateStatInfo(self, path):
56 if path.endswith('/'): 56 if path.endswith('/'):
57 versions = dict((filename, os.stat(os.path.join(path, filename)).st_mtime) 57 versions = dict((filename, os.stat(os.path.join(path, filename)).st_mtime)
58 for filename in os.listdir(path)) 58 for filename in os.listdir(path))
59 else: 59 else:
60 versions = None 60 versions = None
61 return self.StatInfo(os.stat(path).st_mtime, versions) 61 return file_system.StatInfo(os.stat(path).st_mtime, versions)
62 62
63 def Stat(self, path): 63 def Stat(self, path):
64 try: 64 try:
65 return self._CreateStatInfo(os.path.join(self._base_path, path)) 65 return self._CreateStatInfo(os.path.join(self._base_path, path))
66 except OSError: 66 except OSError:
67 raise file_system.FileNotFoundError(path) 67 raise file_system.FileNotFoundError(path)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698