OLD | NEW |
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 sys | 5 import sys |
6 | 6 |
7 import schema_util | 7 import schema_util |
8 from docs_server_utils import ToUnicode | 8 from docs_server_utils import ToUnicode |
9 from file_system import FileNotFoundError | 9 from file_system import FileNotFoundError |
10 from future import Future | 10 from future import Future |
11 from path_util import AssertIsDirectory, AssertIsFile | 11 from path_util import AssertIsDirectory, AssertIsFile, ToDirectory |
12 from third_party.handlebar import Handlebar | 12 from third_party.handlebar import Handlebar |
13 from third_party.json_schema_compiler import json_parse | 13 from third_party.json_schema_compiler import json_parse |
14 from third_party.json_schema_compiler.memoize import memoize | 14 from third_party.json_schema_compiler.memoize import memoize |
15 | 15 |
16 | 16 |
17 _SINGLE_FILE_FUNCTIONS = set() | 17 _SINGLE_FILE_FUNCTIONS = set() |
18 | 18 |
19 | 19 |
20 def SingleFile(fn): | 20 def SingleFile(fn): |
21 '''A decorator which can be optionally applied to the compilation function | 21 '''A decorator which can be optionally applied to the compilation function |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 return cache_data | 229 return cache_data |
230 return self._RecursiveList(path).Then(next) | 230 return self._RecursiveList(path).Then(next) |
231 | 231 |
232 def GetFileVersion(self, path): | 232 def GetFileVersion(self, path): |
233 cache_entry = self._file_object_store.Get(path).Get() | 233 cache_entry = self._file_object_store.Get(path).Get() |
234 if cache_entry is not None: | 234 if cache_entry is not None: |
235 return cache_entry.version | 235 return cache_entry.version |
236 return self._file_system.Stat(path).version | 236 return self._file_system.Stat(path).version |
237 | 237 |
238 def GetFileListingVersion(self, path): | 238 def GetFileListingVersion(self, path): |
239 if not path.endswith('/'): | 239 path = ToDirectory(path) |
240 path += '/' | |
241 cache_entry = self._list_object_store.Get(path).Get() | 240 cache_entry = self._list_object_store.Get(path).Get() |
242 if cache_entry is not None: | 241 if cache_entry is not None: |
243 return cache_entry.version | 242 return cache_entry.version |
244 return self._file_system.Stat(path).version | 243 return self._file_system.Stat(path).version |
245 | 244 |
246 def FileExists(self, path): | 245 def FileExists(self, path): |
247 return self._file_system.Exists(path) | 246 return self._file_system.Exists(path) |
248 | 247 |
249 def GetIdentity(self): | 248 def GetIdentity(self): |
250 return self._file_system.GetIdentity() | 249 return self._file_system.GetIdentity() |
OLD | NEW |