Commit 930b12c9 by David Trowbridge

Switch to using os.path for outdated file checks in compilers.

The outdated file checks in the compilers were using django storages to check
file existence and compare mtimes, but with my recent change (which restored
the older behavior of comparing the infile and outfile), these were operating
on absolute, local files, which could result in a SuspiciousFileOperation.

The compilers always operate on local files, so we can switch to using the
os.path methods for these instead. This is both more correct and more
efficient.
parent 2507820f
...@@ -79,11 +79,12 @@ class CompilerBase(object): ...@@ -79,11 +79,12 @@ class CompilerBase(object):
return '.'.join((path[0], extension)) return '.'.join((path[0], extension))
def is_outdated(self, infile, outfile): def is_outdated(self, infile, outfile):
if not self.storage.exists(outfile): if not os.path.exists(outfile):
return True return True
try: try:
return self.storage.modified_time(infile) > self.storage.modified_time(outfile) return os.path.getmtime(infile) > os.path.getmtime(outfile)
except (OSError, NotImplementedError): except OSError:
return True return True
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment