--- AttachFile.py 2005-01-16 14:35:08.642080009 +1300
+++ AttachFile_backup_with_dia.py 2005-01-16 14:36:17.776347814 +1300
@@ -23,7 +23,7 @@
@license: GNU GPL, see COPYING for details.
"""
-import os, mimetypes, time, urllib
+import cgi, os, mimetypes, string, socket, sys, time, urllib, re
from MoinMoin import config, user, util, wikiutil
from MoinMoin.Page import Page
from MoinMoin.util import MoinMoinNoFooter, filesys
@@ -141,6 +141,25 @@
log.add(request, pagename, request.remote_addr, time.time(),
urllib.quote(filename), action)
+def _backup_file(fpath):
+ """Move the file `fpath` to `fpath,nnn` where `nnn` is one plus `mmm`, where
+ `mmm` is the highest number for which `fpath.mmm` exists, or 000 if no
+ such file exists."""
+
+ # find the right sequence number
+ dirname, basename = os.path.split(fpath)
+ backup_re = re.compile(r'^%s\,(?P ' +
-_("""An upload will never overwrite an existing file. If there is a name
-conflict, you have to rename the file that you want to upload.
-Otherwise, if "Rename to" is left blank, the original filename will be used.""") + '' + _("New Attachment") + '
If "Rename to" is left blank, the original filename will be used.""") + '
') request.write("""