MCPcopy
hub / github.com/pyload/pyload / js_dynamic

Function js_dynamic

module/web/pyload_app.py:172–186  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

170# render js
171@route("/media/js/<path:re:.+\.js>")
172def js_dynamic(path):
173 response.headers['Expires'] = time.strftime("%a, %d %b %Y %H:%M:%S GMT",
174 time.gmtime(time.time() + 60 * 60 * 24 * 2))
175 response.headers['Cache-control'] = "public"
176 response.headers['Content-Type'] = "text/javascript; charset=UTF-8"
177
178 try:
179 # static files are not rendered
180 if "static" not in path and "mootools" not in path:
181 t = env.get_template("js/%s" % path)
182 return t.render()
183 else:
184 return static_file(path, root=join(PROJECT_DIR, "media", "js"))
185 except:
186 return HTTPError(404, "Not Found")
187
188@route('/media/<path:path>')
189def server_static(path):

Callers

nothing calls this directly

Calls 4

static_fileFunction · 0.90
HTTPErrorClass · 0.90
get_templateMethod · 0.80
renderMethod · 0.45

Tested by

no test coverage detected