Skip to content

Instantly share code, notes, and snippets.

@jobelenus
Created January 30, 2014 17:34
Show Gist options
  • Save jobelenus/8714087 to your computer and use it in GitHub Desktop.
Save jobelenus/8714087 to your computer and use it in GitHub Desktop.
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