Autodoc
-
class html5_appcache.appcache_base.AppCacheManager[source]
Main class.
-
_fetch_url(client, url)[source]
Scrape a single URL and fetches assets
-
_get_sitemap()[source]
Pretty ugly method that fetches the current sitemap and parses it to
retrieve the list of available urls
-
_setup_signals()[source]
Loads the signals for all the models declared in the appcache instances
-
add_appcache(appcache)[source]
Adds the externally retrieved urls to the internal set.
appcache is a dictionary with cached, network, fallback keys
Run through the cached urls and fetches assets by scraping the pages
-
get_cached_urls()[source]
Create the cached urls set.
Merges the assets, the urls, removes the network urls and the external urls
See BaseAppCache.get_urls(), get_network_urls()
-
get_fallback_urls()[source]
Creates the fallback urls set.
-
get_manifest(update=False)[source]
Either get the manifest file out of the cache or render it and save in
the cache.
-
get_network_urls()[source]
Create the network urls set.
* (wildcard entry) is added when ADD_WILDCARD is True (default)
-
get_urls()[source]
Retrieves the urls from the sitemap and BaseAppCache.get_urls() of
the appcache instances
-
get_version_timestamp()[source]
Create the timestamp according to the current time.
It tries to make it unique even for very short timeframes
-
reset_manifest()[source]
Clear the cache (if clean)
-
setup(request, template)[source]
Setup is required wen updating the manifest file
-
setup_registry()[source]
Setup the manager bootstrapping the appcache instances
-
class html5_appcache.appcache_base.BaseAppCache[source]
Base class for Appcache classes
-
_add_language(request, urls)[source]
For django CMS 2.3 we need to manually add language code to the
urls returned by the appcache classes
-
_get_assets(request)[source]
override this method to customize asset (images, files, javascripts,
stylesheets) urls.
-
_get_fallback(request)[source]
override this method to define fallback urls.
Returns: | dictionary mapping original urls to fallback |
-
_get_network(request)[source]
override this method to define network (non-cached) urls.
-
_get_urls(request)[source]
override this method to define cached urls.
If you use a sitemap-enabled application, it’s not normally necessary.
-
get_assets(request)[source]
Public method that return assets urls. Do not override, use _get_assets()
-
get_fallback(request)[source]
Public method that return fallback urls. Do not override, use _get_fallback()
Returns: | dictionary mapping original urls to fallback |
-
get_network(request)[source]
Public method that return network (non-cached) urls. Do not override, use _get_network()
-
get_urls(request)[source]
Public method that return cached urls. Do not override, use _get_urls()
-
signal_connector(instance, **kwargs)[source]
You must override this method in you AppCache class.
-
class html5_appcache.middleware.appcache_middleware.AppCacheAssetsFromResponse[source]
Extracts appcache assets from the rendered template.
- Currently supports the following tags:
- img: extracts the data in the src attribute
- script: extracts the data in the src attribute
- link: extracts the data in the href attribute if rel==stylesheet
- It supports custom data-attribute to exclude assets from caching:
- data-appcache=’noappcache’: the referenced url is added to the NETWORK
section
- data-appcache-fallback=URL: the referenced url is added in the
FALLBACK section, with URL as a target
-
handle_img(tag, attrib)[source]
Extract assets from the img tag
-
handle_link(tag, attrib)[source]
Extract assets from the link tag (only for stylesheets)
-
handle_script(tag, attrib)[source]
Extract assets from the script tag
-
process_response(request, response)[source]
This method is called only if appcache_analyze parameter is attached
to the querystring, to avoid overhead during normal navigation
-
walk_tree(tree)[source]
Walk the DOM tree