Exemple #1
0
 def needs_update(self, output_file, source_files, version):
     output_file_name = get_output_filename(output_file, version)
     ph = settings.COMPRESS_VERSION_PLACEHOLDER
     of = output_file
     try:
         phi = of.index(ph)
         old_version = output_file_name[phi:phi+len(ph)-len(of)]
         return (version != old_version), version
     except ValueError:
         # no placeholder found, do not update, manual update if needed
         return False, version
def render_common(template_name, obj, filename, version):
    if settings.COMPRESS:
        filename = get_output_filename(filename, version)

    context = obj.get('extra_context', {})
    prefix = context.get('prefix', None)
    if filename.startswith('http://'):
        context['url'] = filename
    else:
        context['url'] = media_url(filename, prefix)
        
    return template.loader.render_to_string(template_name, context)
Exemple #3
0
    def needs_update(self, output_file, source_files, version):

        output_file_name = get_output_filename(output_file, version)
        compressed_file_full = media_root(output_file_name)

        return (int(os.stat(compressed_file_full).st_mtime) < int(version)), version