Opened on 04/30/2015 at 01:46:04 PM
Closed on 04/30/2015 at 08:41:35 PM
#2440 closed change (fixed)
[cms] Add support for cache files
Reported by: | sebastian | Assignee: | sebastian |
---|---|---|---|
Priority: | P3 | Milestone: | |
Module: | Sitescripts | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | #2432 | Platform: | Unknown |
Ready: | yes | Confidential: | no |
Tester: | Verified working: | no | |
Review URL(s): |
Description (last modified by sebastian)
Background
Currently, there is no place custom filters and globals can store persistent data. However, sometimes you need to cache some data (e.g. to prevent site generation from crashing when external resources aren't available). This currently the case with #2432.
What to change
Implement Source.get_cache_dir() to be used by custom filters and globals via contextfilter and contextfunction.
When the website is generated (or served with the development server) from a local directory get_cache_dir() should return the absolute path to the cache subdirectory under the website's root.
If the website is generated via Mercurial, /var/cache/<repo-path> should be returned on unix. Other platforms don't need to be considered for this case.
https://hg.adblockplus.org/cms/rev/d495c9fbea15