Skip to content

Instantly share code, notes, and snippets.

@jobelenus
Created January 30, 2014 17:26
Show Gist options
  • Save jobelenus/8713919 to your computer and use it in GitHub Desktop.
Save jobelenus/8713919 to your computer and use it in GitHub Desktop.
import os
from compressor.conf import settings
class DynamicManifestStorageMixin(object):
"""
Use this Mixin to dynamically name the manifest file which will prevent
problems surrounding CDN edges/TTL and purge commands taking minutes
"""
def get_available_name(self, name):
"""
Determine filename to save
"""
dir_name, file_name = os.path.split(name)
file_root, file_ext = os.path.splitext(file_name)
if file_name == settings.COMPRESS_OFFLINE_MANIFEST:
file_name = self._get_dynamic_name()
return os.path.join(dir_name, file_name)
def _get_dynamic_name(self):
return ''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment