Since the file is still in use, deleting it will be rejected. Since we
want to replace the file, we will have to force deleting as the file is
being replaced immediately.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
# Replace any existing files
file = self.get_file_by_path_and_filename(path, filename)
if file:
- file.delete(author)
+ file.delete(author, force=True)
# Upload the blob first
blob = self.db.get("""
timestamp = created_at
- def delete(self, author=None):
- if not self.can_be_deleted():
+ def delete(self, author=None, force=False):
+ if not force and not self.can_be_deleted():
raise RuntimeError("Cannot delete %s" % self)
self.db.execute("UPDATE wiki_files SET deleted_at = NOW(), deleted_by = %s \