Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Delete old version of the file before saving the new one #4

Merged
merged 1 commit into from

2 participants

@kux
kux commented

Since filer no longer overwrites files with the same name (see FILE_OVERWRITE setting in s3boto storage backend)
=> it makes more sense to delete the prev file before saving again, thus avoiding the generation of a new file with a new auto-generated name.

@kux kux Since filer no longer overwrites files with the same name (see FILE_O…
…VERWRITE setting in s3boto storage backend)

 => it makes more sense to delete the prev file before saving again, thus avoiding the generation of a new file.
0fba849
@bhodorog bhodorog merged commit 3db0e64 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 26, 2012
  1. @kux

    Since filer no longer overwrites files with the same name (see FILE_O…

    kux authored
    …VERWRITE setting in s3boto storage backend)
    
     => it makes more sense to delete the prev file before saving again, thus avoiding the generation of a new file.
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 0 deletions.
  1. +1 −0  filertags/signals.py
View
1  filertags/signals.py
@@ -89,6 +89,7 @@ def _rewrite_file_content(filer_file, new_content):
storage = filer_file.file.storage
fp = ContentFile(new_content, filer_file.file.name)
filer_file.file.file = fp
+ storage.delete(filer_file.file.name)
filer_file.file.name = storage.save(filer_file.file.name, fp)
# all code in filer.filemodels.File.save which percedes the call to
# super(File, self).save will be executed BEFORE the resolve_resource_urls
Something went wrong with that request. Please try again.