X-Git-Url: https://v.licheni.net/stack/cam.git/blobdiff_plain/de74ecfb399e9c18e476104744856fde67ea2e81..112c04e3926d62291efd902a1dcb0b2d24feeb59:/cam/utils.py?ds=inline diff --git a/cam/utils.py b/cam/utils.py new file mode 100644 index 0000000..e5685f2 --- /dev/null +++ b/cam/utils.py @@ -0,0 +1,16 @@ +import os + + +_template_dir = os.path.join(os.path.dirname(__file__), 'templates') + + +def render(output_file, template_name, args): + tpl = open(os.path.join(_template_dir, template_name), 'r') + outfd = open(output_file, 'w') + outfd.write(tpl.read() % args) + tpl.close() + outfd.close() + + +def parse_bool(s): + return s.lower() in ('1', 'y', 'yes', 'true', 'on')