Exemplo n.º 1
0
def compile_template(template_name, output, context={}):
    """It takes a tempate name, renders that template and the rendered content
    is compiled into a plain text file inside output
    """
    try:
        content = render_template(template_name, context)
        touch(output)
        with open(output, "w") as f:
            f.write(content)
    except TemplateNotFound:
        pass
Exemplo n.º 2
0
Arquivo: init.py Projeto: anler/mdblog
def main(argv=None):
    if argv is None:
        argv = sys.argv[1:]

    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument("name", type=valid_name, help="Your blog's name")

    args = parser.parse_args(argv)

    project_name = args.name

    touch("%s/%s/base.html" % (project_name, templates_path))
    touch("%s/%s/index.html" % (project_name, templates_path))
Exemplo n.º 3
0
 def test_touch_nested(self):
     "Test that creates directories if the don't exist and empty files"
     utils.touch("a/b/c")
     self.assertTrue(os.path.isfile("a/b/c"))
Exemplo n.º 4
0
 def test_touch(self):
     "Test that creates empty files"
     utils.touch("a")
     self.assertTrue(os.path.isfile("a"))