[Mpuls-commits] r4342 - in base/trunk: . mpulsweb/controllers mpulsweb/lib
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Thu Dec 9 14:36:30 CET 2010
Author: roland
Date: 2010-12-09 14:36:28 +0100 (Thu, 09 Dec 2010)
New Revision: 4342
Modified:
base/trunk/ChangeLog
base/trunk/mpulsweb/controllers/casedocument.py
base/trunk/mpulsweb/lib/validators.py
Log:
issue1419: fix problem with uploaded documents with the same name if they were uploaded with IE7
Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog 2010-12-09 10:51:13 UTC (rev 4341)
+++ base/trunk/ChangeLog 2010-12-09 13:36:28 UTC (rev 4342)
@@ -1,5 +1,11 @@
2010-12-06 Roland Geider <roland.geider at intevation.de>
+ * mpulsweb/controllers/casedocument.py,
+ mpulsweb/lib/validators.py: issue1419: fix problem with uploaded
+ documents with the same name if they were uploaded with IE7
+
+2010-12-06 Roland Geider <roland.geider at intevation.de>
+
* mpulsweb/templates/casemanagement/main.mako: issue1544: don't open
the confirmation dialog for copying cases in a new window
Modified: base/trunk/mpulsweb/controllers/casedocument.py
===================================================================
--- base/trunk/mpulsweb/controllers/casedocument.py 2010-12-09 10:51:13 UTC (rev 4341)
+++ base/trunk/mpulsweb/controllers/casedocument.py 2010-12-09 13:36:28 UTC (rev 4342)
@@ -60,7 +60,7 @@
content = result['file']['content']
case = result['case']
if result['name']:
- # Make sure the new name as a (3 letter) extension
+ # Make sure the new name has a (3 letter) extension
if '.' not in result['name'][-4:]:
extension = filename.rpartition('.')[2]
filename = result['name'] + '.' + extension
Modified: base/trunk/mpulsweb/lib/validators.py
===================================================================
--- base/trunk/mpulsweb/lib/validators.py 2010-12-09 10:51:13 UTC (rev 4341)
+++ base/trunk/mpulsweb/lib/validators.py 2010-12-09 13:36:28 UTC (rev 4342)
@@ -113,11 +113,16 @@
ref = ''
file = field_dict[self.field_names[0]]
- # if user gives a userdefined name for the file take ths to check if
+
+ # if user gives a userdefined name for the file take this to check if
# the file is already existent. Else take filename from file
name = field_dict[self.field_names[1]]
if not name:
- name = file.get('filename')
+ # IE7 Fix: IE7 (and probably 6) will happily send the whole path of
+ # the file. The rest of the civilized world only sends the filename.
+ # So, split the "filename" by '\' , take the last part and go on on
+ # our merry ways
+ name = file.get('filename').split('\\')[-1]
field_dict[self.field_names[1]] = name
ow = field_dict[self.field_names[2]]
@@ -128,8 +133,8 @@
sql = self.globaldoc_sql
errors = {}
- # Only check if there is a file with name in DB, if teh user do not
- # what do overwrite the files with the same name.
+ # Only check if there is a file with name in DB, if the user does not
+ # want to overwrite the files with the same name.
if not ow:
conn, cur = None, None
try:
More information about the Mpuls-commits
mailing list