Esempio n. 1
0
def do_preparse_bundle():
  """
  Pre compile all the jinja2 templates in Kay itself.
  """
  print_status("Compiling bundled templates...")
  app = kay.app.get_application()
  env = app.app.jinja2_env
  for dir in find_template_dir(kay.KAY_DIR, ('debug','app_template')):
    dest = prepare_destdir(dir)
    print_status("Now compiling templates in %s to %s." % (dir, dest))
    compile_dir(env, dir, dest)
  print_status("Finished compiling bundled templates...")
Esempio n. 2
0
def do_preparse_bundle():
    """
  Pre compile all the jinja2 templates in Kay itself.
  """
    print_status("Compiling bundled templates...")
    app = kay.app.get_application()
    env = app.app.jinja2_env
    for dir in find_template_dir(kay.KAY_DIR, ('debug', 'app_template')):
        dest = prepare_destdir(dir)
        print_status("Now compiling templates in %s to %s." % (dir, dest))
        compile_dir(env, dir, dest)
    print_status("Finished compiling bundled templates...")
Esempio n. 3
0
def compile_app_templates(app):
  env = app.jinja2_env
  target_dirs = [dir for dir in app.app_settings.TEMPLATE_DIRS\
                   if os.path.isdir(dir)]
  for app in app.app_settings.INSTALLED_APPS:
    #if app.startswith("kay."):
    #  continue
    mod = import_string(app)
    target_dirs.extend(find_template_dir(os.path.dirname(mod.__file__),
                                         ('kay')))
  for dir in target_dirs:
    dest = prepare_destdir(dir)
    print_status("Now compiling templates in %s to %s." % (dir, dest))
    compile_dir(env, dir, dest)
Esempio n. 4
0
def compile_app_templates(app):
    env = app.jinja2_env
    target_dirs = [dir for dir in app.app_settings.TEMPLATE_DIRS\
                     if os.path.isdir(dir)]
    for app in app.app_settings.INSTALLED_APPS:
        if app.startswith("kay."):
            continue
        mod = import_string(app)
        target_dirs.extend(
            find_template_dir(os.path.dirname(mod.__file__), ('kay')))
    for dir in target_dirs:
        dest = prepare_destdir(dir)
        print_status("Now compiling templates in %s to %s." % (dir, dest))
        compile_dir(env, dir, dest)