made signature algorithm configurable
[stack/cam.git] / cam / utils.py
1 import os
2
3
4 _template_dir = os.path.join(os.path.dirname(__file__), 'templates')
5
6
7 def render(output_file, template_name, args):
8     tpl = open(os.path.join(_template_dir, template_name), 'r')
9     outfd = open(output_file, 'w')
10     outfd.write(tpl.read() % args)
11     tpl.close()
12     outfd.close()
13
14
15 def parse_bool(s):
16     return s.lower() in ('1', 'y', 'yes', 'true', 'on')