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

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

Issue 10828235: Extensions Docs Server: Efficient MemcacheFileSystem (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 27 matching lines...) Expand all
38 38
39 def Read(self, paths, binary=False): 39 def Read(self, paths, binary=False):
40 result = {} 40 result = {}
41 for path in paths: 41 for path in paths:
42 if path.endswith('/'): 42 if path.endswith('/'):
43 result[path] = self._ListDir(self._ConvertToFilepath(path)) 43 result[path] = self._ListDir(self._ConvertToFilepath(path))
44 else: 44 else:
45 result[path] = self._ReadFile(self._ConvertToFilepath(path), binary) 45 result[path] = self._ReadFile(self._ConvertToFilepath(path), binary)
46 return Future(value=result) 46 return Future(value=result)
47 47
48 def _CreateStatInfo(self, path):
49 versions = [(filename, os.stat(os.path.join(path, filename)).st_mtime)
50 for filename in os.listdir(path)]
not at google - send to devlin 2012/08/10 06:42:24 can construct the dict without an intermediate lis
cduvall 2012/08/11 00:15:23 Done.
51 return self.StatInfo(os.stat(path).st_mtime, dict(versions))
52
48 def Stat(self, path): 53 def Stat(self, path):
49 return self.StatInfo(os.stat(os.path.join(self._base_path, path)).st_mtime) 54 if '/' in path:
55 par_dir = path.rsplit('/', 1)[0] + '/'
56 else:
57 par_dir = '.'
58 return self._CreateStatInfo(os.path.join(self._base_path, par_dir))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698