Commit 6bb3f67c by Timothée Peignier

fix cleanup method

parent 2fd5d4b5
...@@ -51,11 +51,11 @@ class Versioning(object): ...@@ -51,11 +51,11 @@ class Versioning(object):
def cleanup(self, filename): def cleanup(self, filename):
if not settings.COMPRESS_VERSION and not settings.COMPRESS_VERSION_REMOVE_OLD: if not settings.COMPRESS_VERSION and not settings.COMPRESS_VERSION_REMOVE_OLD:
return # Nothing to delete here return # Nothing to delete here
filename = settings.COMPRESS_VERSION_PLACEHOLDER.join([re.escape(part) for part in filename.split(settings.COMPRESS_VERSION_PLACEHOLDER)])
path = os.path.dirname(filename) path = os.path.dirname(filename)
filename = settings.COMPRESS_VERSION_PLACEHOLDER.join([re.escape(part) for part in filename.split(settings.COMPRESS_VERSION_PLACEHOLDER)])
regex = re.compile(r'^%s$' % os.path.basename(self.output_filename(filename, r'([A-Za-z0-9]+)'))) regex = re.compile(r'^%s$' % os.path.basename(self.output_filename(filename, r'([A-Za-z0-9]+)')))
if storage.exists(path): if storage.exists(path):
for f in storage.listdir(path): for f in storage.listdir(path)[1]:
if regex.match(f): if regex.match(f):
if self.verbose: if self.verbose:
print "Removing outdated file %s" % f print "Removing outdated file %s" % f
......
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