OLD | NEW |
---|---|
(Empty) | |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
not at google - send to devlin
2013/04/30 16:21:09
(c) 2012 -> 2013. Check other files too.
jshumway
2013/05/03 03:44:39
Correct in new file.
| |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 | |
5 import os | |
6 | |
7 class CompiledFileSystemSource(object): | |
not at google - send to devlin
2013/04/30 16:21:09
Anything more complicated than the Identity functi
jshumway
2013/05/03 03:44:39
I replaced this class with ManifestDataSource. It
not at google - send to devlin
2013/05/03 15:56:24
Any amount of > 0 triviality is worth testing, and
jshumway
2013/05/10 02:08:36
Done.
| |
8 """ Exposes a CompiledFileSystem to a template. | |
9 """ | |
10 def __init__(self, compiled_fs, basepath, transformer): | |
11 """ |transformer| is a function that takes one argument, the key a template | |
12 is looking up, and returns a new key. |basepath| is then prepended to the | |
13 new key and the result is used to lookup a document in |complied_fs|. | |
14 """ | |
15 self.compiled_fs = compiled_fs | |
16 self.basepath = basepath | |
17 self.transformer = transformer | |
18 | |
19 def get(self, key): | |
20 return self.compiled_fs.GetFromFile( | |
21 os.path.join(self.basepath, self.transformer(key))) | |
OLD | NEW |