Extension reference

class flask_cache_manifest.FlaskCacheManifest(app=None)[source]
__init__(app=None)[source]

Constructor function for FlaskCacheManifest. It will call FlaskCacheManifest.init_app() automatically if the app parameter is provided.

Parameters:

app (flask.Flask) -- A Flask application.

init_app(app)[source]

Initializes the extension and loads the various cache_manifest.json files. It adds hashed_url_for() to the template globals for use in Jinja templates.

Parameters:

app (flask.Flask) -- A Flask application.

load_manifest(endpoint, scaffold)[source]

Called automatically during init_app but can be called manually to load blueprints after the initialization.

Parameters:
  • endpoint (str) -- The endpoint the blueprint is registered as.

  • scaffold (flask.Blueprint) -- A Flask application or a registered blueprint.

hashed_url_for(endpoint, **values)[source]

Generate a URL to the given endpoint with the given values by Extending the functionality of Flask's url_for(). Arguments will be forwarded to url_for, with the only values['filename'] being mutated to the appropriate hashed filename.

Parameters:
  • endpoint (str) -- The endpoint of the URL (name of the function).

  • values -- The variable arguments of the URL rule.

  • _external (bool, optional) -- If set to True, an absolute URL is generated. Server address can be changed via SERVER_NAME configuration variable which falls back to the Host header, then to the IP and port of the request.

  • _scheme (str, optional) -- A string specifying the desired URL scheme. The _external parameter must be set to True or a ValueError is raised. The default behavior uses the same scheme as the current request, or PREFERRED_URL_SCHEME from the app configuration if no request context is available. As of Werkzeug 0.10, this also can be set to an empty string to build protocol-relative URLs.

  • _anchor (str, optional) -- If provided this is added as anchor to the URL.

  • _method (str, optional) -- If provided this explicitly specifies an HTTP method.

Return type:

str