[Mpuls-commits] r4140 - in base/trunk: . mpulsweb/controllers

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Nov 10 09:52:37 CET 2010


Author: roland
Date: 2010-11-10 09:52:36 +0100 (Wed, 10 Nov 2010)
New Revision: 4140

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/controllers/casedocument.py
Log:
issue1387: allow changing the name of files without breaking the extension

Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2010-11-10 08:01:19 UTC (rev 4139)
+++ base/trunk/ChangeLog	2010-11-10 08:52:36 UTC (rev 4140)
@@ -1,5 +1,10 @@
 2010-11-10  Roland Geider <roland.geider at intevation.de>
 
+	* mpulsweb/controllers/casedocument.py: issue1387: allow changing the
+	  name of files without breaking the extension
+
+2010-11-10  Roland Geider <roland.geider at intevation.de>
+
 	* mpulsweb/public/styles/all.css: issue1281: case overview too small
 	  for icons
 

Modified: base/trunk/mpulsweb/controllers/casedocument.py
===================================================================
--- base/trunk/mpulsweb/controllers/casedocument.py	2010-11-10 08:01:19 UTC (rev 4139)
+++ base/trunk/mpulsweb/controllers/casedocument.py	2010-11-10 08:52:36 UTC (rev 4140)
@@ -60,7 +60,12 @@
             content = result['file']['content']
             case = result['case']
             if result['name']:
-                filename = result['name']
+                # Make sure the new name as a (3 letter) extension
+                if '.' not in result['name'][-4:]:
+                    extension = filename.rpartition('.')[2]
+                    filename = result['name'] + '.' + extension
+                else:
+                    filename = result['name']
             doc.create(filename, content, case)
             c.dialog_title = SET_ATTACHMENT_SUCCESS_HEADER
             c.dialog_text = OK_TO_CONTINUE



More information about the Mpuls-commits mailing list