forked from mleglise/django-compress
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
27 additions
and
20 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,20 @@ | ||
import os | ||
|
||
from compress.utils import get_output_filename, media_root | ||
from compress.utils import get_output_filename, compress_source, compress_root | ||
from compress.versioning.base import VersioningBase | ||
|
||
class MTimeVersioning(VersioningBase): | ||
|
||
def get_version(self, source_files): | ||
|
||
# Return the modification time for the newest source file | ||
return str(max([int(os.stat(media_root(f)).st_mtime) for f in source_files])) | ||
return str(max( | ||
[int(os.stat(compress_source(f)).st_mtime) for f in source_files])) | ||
|
||
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) | ||
compressed_file_full = compress_root(output_file_name) | ||
|
||
return (int(os.stat(compressed_file_full).st_mtime) < int(version)), version | ||
|