diff MoinMoin/action/AttachFile.py @ 2846:4825f1a252dc

catch error when saving a drawing
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Thu, 20 Sep 2007 18:39:32 +0200
parents 907b9e60c232
children 48a1f6b6b6c5
line wrap: on
line diff
--- a/MoinMoin/action/AttachFile.py	Thu Sep 20 18:00:12 2007 +0200
+++ b/MoinMoin/action/AttachFile.py	Thu Sep 20 18:39:32 2007 +0200
@@ -26,7 +26,7 @@
     @license: GNU GPL, see COPYING for details.
 """
 
-import os, time, zipfile, mimetypes
+import os, time, zipfile, mimetypes, errno
 
 from MoinMoin import config, wikiutil, packages
 from MoinMoin.Page import Page
@@ -717,7 +717,11 @@
     savepath = os.path.join(attach_dir, basename + ext)
     if ext == '.map' and not filecontent.strip():
         # delete map file if it is empty
-        os.unlink(savepath)
+        try:
+            os.unlink(savepath)
+        except OSError, err:
+            if err.errno != errno.ENOENT: # no such file
+                raise
     else:
         stream = open(savepath, 'wb')
         try: