Beispiel #1
0
def server_js(theme, file):
    response.headers['Content-Type'] = "text/javascript; charset=UTF-8"

    if "/render/" in file or ".render." in file or True:
        response.headers['Expires'] = time.strftime("%a, %d %b %Y %H:%M:%S GMT",
                                                    time.gmtime(time.time() + 24 * 7 * 60 * 60))
        response.headers['Cache-control'] = "public"

        path = "/".join((theme, file))
        return env.get_template(path).render()
    else:
        return server_static(theme, file)
Beispiel #2
0
def server_js(theme, file):
    response.headers['Content-Type'] = "text/javascript; charset=UTF-8"

    if "/render/" in file or ".render." in file or True:
        response.headers['Expires'] = time.strftime("%a, %d %b %Y %H:%M:%S GMT",
                                                    time.gmtime(time.time() + 24 * 7 * 60 * 60))
        response.headers['Cache-control'] = "public"

        path = "/".join((theme, file))
        return env.get_template(path).render()
    else:
        return server_static(theme, file)
Beispiel #3
0
def render_to_response(file, args={}, proc=[]):
    for p in proc:
        args.update(p())
    path = "tml/" + file
    return env.get_template(path).render(**args)
Beispiel #4
0
def render_to_response(file, args={}, proc=[]):
    for p in proc:
        args.update(p())
    path = "tml/" + file
    return env.get_template(path).render(**args)