Autodoc¶
-
class
html5_appcache.appcache_base.
AppCacheManager
[source]¶ Main class.
-
_get_sitemap
()[source]¶ Pretty ugly method that fetches the current sitemap and parses it to retrieve the list of available urls
-
add_appcache
(appcache)[source]¶ Adds the externally retrieved urls to the internal set.
appcache is a dictionary with cached, network, fallback keys
-
get_cached_urls
()[source]¶ Create the cached urls set.
Merges the assets, the urls, removes the network urls and the external urls
-
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 whenADD_WILDCARD
is True (default)
-
get_urls
()[source]¶ Retrieves the urls from the sitemap and
BaseAppCache.get_urls()
of 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
Returns: list of urls
-
_get_assets
(request)[source]¶ override this method to customize asset (images, files, javascripts, stylesheets) urls.
Returns: list of 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.
Returns: list of urls
-
_get_urls
(request)[source]¶ override this method to define cached urls.
If you use a sitemap-enabled application, it’s not normally necessary.
Returns: list of urls
-
get_assets
(request)[source]¶ Public method that return assets urls. Do not override, use
_get_assets()
Returns: list of urls
-
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()
Returns: list of urls
-
get_urls
(request)[source]¶ Public method that return cached urls. Do not override, use
_get_urls()
Returns: list of urls
-
-
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 ifrel==stylesheet
- img: extracts the data in the
- It supports custom data-attribute to exclude assets from caching:
- data-appcache=’noappcache’: the referenced url is added to the NETWORK section
- data-appcache=’appcache’: the referenced url is added to the CACHE section
- data-appcache-fallback=URL: the referenced url is added in the FALLBACK section, with URL as a target