OLD | NEW |
1 # Copyright 2013 The Swarming Authors. All rights reserved. | 1 # Copyright 2013 The LUCI Authors. All rights reserved. |
2 # Use of this source code is governed by the Apache v2.0 license that can be | 2 # Use of this source code is governed by the Apache v2.0 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 from components import template | 7 from components import template |
8 import config | 8 import config |
9 | 9 |
10 ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) | 10 ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) |
11 | 11 |
12 | 12 |
13 def bootstrap(): | 13 def bootstrap(): |
14 template.bootstrap({'isolate': os.path.join(ROOT_DIR, 'templates')}) | 14 template.bootstrap({'isolate': os.path.join(ROOT_DIR, 'templates')}) |
15 | 15 |
16 | 16 |
17 def render(name, params=None): | 17 def render(name, params=None): |
18 """Shorthand to render a template.""" | 18 """Shorthand to render a template.""" |
19 out = { | 19 out = { |
20 'google_analytics': config.settings().google_analytics, | 20 'google_analytics': config.settings().google_analytics, |
21 } | 21 } |
22 out.update(params or {}) | 22 out.update(params or {}) |
23 return template.render(name, out) | 23 return template.render(name, out) |
OLD | NEW |