Permalink
Browse files

added setting OVERWRITE_EXISTING

  • Loading branch information...
1 parent 0395070 commit 9b5bb1cd3955c75e149174da5d923f63bdc27c80 @sehmaschine committed Sep 6, 2012
Showing with 3 additions and 1 deletion.
  1. +2 −0 filebrowser/settings.py
  2. +1 −1 filebrowser/sites.py
View
@@ -115,6 +115,8 @@
SEARCH_TRAVERSE = getattr(settings, "FILEBROWSER_SEARCH_TRAVERSE", False)
# Default Upload and Version Permissions
DEFAULT_PERMISSIONS = getattr(settings, "FILEBROWSER_DEFAULT_PERMISSIONS", 0755)
+# Overwrite existing files on upload
+OVERWRITE_EXISTING = getattr(settings, "FILEBROWSER_OVERWRITE_EXISTING", True)
# EXTRA TRANSLATION STRINGS
# The following strings are not availabe within views or templates
View
@@ -486,7 +486,7 @@ def _upload_file(self, request):
signals.filebrowser_pre_upload.send(sender=request, path=request.POST.get('folder'), file=filedata)
uploadedfile = handle_file_upload(path, filedata, site=self)
- if file_already_exists:
+ if file_already_exists and OVERWRITE_EXISTING:
old_file = smart_unicode(file_name)
new_file = smart_unicode(uploadedfile)
self.storage.move(new_file, old_file, allow_overwrite=True)

0 comments on commit 9b5bb1c

Please sign in to comment.