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

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

Issue 14273041: Doc server manifest page generation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 7 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
OLDNEW
(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)))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698