Created
January 30, 2014 17:34
-
-
Save jobelenus/8714087 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_offline_manifest_filename(): | |
output_dir = settings.COMPRESS_OUTPUT_DIR.strip('/') | |
return os.path.join(output_dir, settings.COMPRESS_OFFLINE_MANIFEST) | |
_offline_manifest = None | |
def get_offline_manifest(): | |
global _offline_manifest | |
if _offline_manifest is None: | |
filename = get_offline_manifest_filename() | |
if default_storage.exists(filename): | |
_offline_manifest = simplejson.load(default_storage.open(filename)) | |
else: | |
_offline_manifest = {} | |
return _offline_manifest | |
def flush_offline_manifest(): | |
global _offline_manifest | |
_offline_manifest = None | |
def write_offline_manifest(manifest): | |
filename = get_offline_manifest_filename() | |
default_storage.save(filename, | |
ContentFile(simplejson.dumps(manifest, indent=2))) | |
flush_offline_manifest() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment