Ignore:
Timestamp:
21 Jul 2012, 16:41:08 (12 years ago)
Author:
Henrik Bettermann
Message:

Do not allow to upload file with filename which already exists in finished or unfinished folder.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/pages.py

    r9033 r9038  
    844844                self.flash(_("Only csv files are allowed."))
    845845                return
    846             target = os.path.join(self.context.storage,
    847                                   self.getNormalizedFileName(filename))
     846            normalized_filename = self.getNormalizedFileName(filename)
     847            finished_file = os.path.join(
     848                self.context.storage, 'finished', normalized_filename)
     849            unfinished_file = os.path.join(
     850                self.context.storage, 'unfinished', normalized_filename)
     851            if os.path.exists(finished_file) or os.path.exists(unfinished_file):
     852                self.flash(_("File with same name was uploaded earlier."))
     853                return
     854            target = os.path.join(self.context.storage, normalized_filename)
    848855            open(target, 'wb').write(uploadfile.read())
    849856            os.chmod(target, 0664)
Note: See TracChangeset for help on using the changeset viewer.