[Mpuls-commits] r1497 - wasko/branches/2.0/mpulsweb/controllers

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Feb 11 09:01:02 CET 2010


Author: torsten
Date: 2010-02-11 09:01:02 +0100 (Thu, 11 Feb 2010)
New Revision: 1497

Modified:
   wasko/branches/2.0/mpulsweb/controllers/document.py
Log:
* mpulsweb/controllers/document.py (DocumentController.globalDelete), 
(DocumentController.globalUploadAction): Adapted c-vars for dialogs.


Modified: wasko/branches/2.0/mpulsweb/controllers/document.py
===================================================================
--- wasko/branches/2.0/mpulsweb/controllers/document.py	2010-02-11 07:55:30 UTC (rev 1496)
+++ wasko/branches/2.0/mpulsweb/controllers/document.py	2010-02-11 08:01:02 UTC (rev 1497)
@@ -27,23 +27,15 @@
 # Authors:
 # Sascha L. Teichmann <teichmann at intevation.de>
 #
-
-import sys
 import logging
-import traceback
 
 import paste
 from pylons import config
 
+from mpulsweb.lib.base import BaseController, c, h, redirect_to, render, request
 from mpulsweb.lib.security import checkRole
 from mpulsweb.model.document import Document, listDocuments, deleteDocument
 
-from mpulsweb.lib.base import BaseController, c, h, redirect_to, render, request
-
-
-log = logging.getLogger(__name__)
-
-
 SET_DOCUMENT_SUCCESS_HEADER = u"""Dokument hinzugefügt!"""
 SET_DOCUMENT_SUCCESS_TEXT = u"""Bitte klicken Sie auf "OK", um fortzufahren."""
 SET_DOCUMENT_FAILED_HEADER = u"""Kein Dokument hinzugefügt!"""
@@ -76,6 +68,8 @@
 Wollen Sie die Anlage wirklich löschen und die Daten unwiederbringlich
 verlieren?"""
 
+log = logging.getLogger(__name__)
+
 class DocumentController(BaseController):
 
     @checkRole(('admin_ka', 'cm_ka'))
@@ -104,8 +98,8 @@
                 myfile = request.POST.get('file')
                 if not myfile is None:
                     doc.create(myfile.filename, myfile.file)
-                    c.success_for = SET_DOCUMENT_SUCCESS_HEADER
-                    c.success_text = SET_DOCUMENT_SUCCESS_TEXT
+                    c.dialog_title = SET_DOCUMENT_SUCCESS_HEADER
+                    c.dialog_text = SET_DOCUMENT_SUCCESS_TEXT
                     c.url_ok = h.url_for(controller="document",
                                          action="globalOverview")
                     return render('/documents/dialogs/success_documents.mako')
@@ -113,18 +107,15 @@
                 if not myfile is None:
                     try:
                         myfile.file.close()
-                    except:
-                        pass
+                    except Exception, e:
+                        log.exception(e)
         except Exception, e:
             log.exception(e)
-            c.failed_for = SET_DOCUMENT_FAILED_HEADER
-            c.failed_text = SET_DOCUMENT_FAILED_TEXT
+            c.dialog_title = SET_DOCUMENT_FAILED_HEADER
+            c.dialog_text = SET_DOCUMENT_FAILED_TEXT
             c.url_ok = h.url_for(controller="document", action="globalUpload")
             return render('/documents/dialogs/failed_document.mako')
 
-            return self.globalUpload()
-
-
     @checkRole(('admin_ka', 'cm_ka'))
     def globalShow(self, id):
         id = self._checkInt(id)
@@ -152,13 +143,13 @@
                 return self.globalOverview()
             c.url_ok = h.url_for(controller="/document",
                                  action="globalOverview")
-            c.success_for = SET_DOCUMENT_SUCCESS_DELETE_HEADER
-            c.success_text = SET_DOCUMENT_SUCCESS_DELETE_TEXT
+            c.dialog_title = SET_DOCUMENT_SUCCESS_DELETE_HEADER
+            c.dialog_text = SET_DOCUMENT_SUCCESS_DELETE_TEXT
             return render('/documents/dialogs/delete_document_success.mako')
         else:
             c.context = "../main.mako"
-            c.confirm_for = SET_DOCUMENT_CONFIRM_DELETE_HEADER
-            c.question = SET_DOCUMENT_CONFIRM_DELETE_TEXT
+            c.dialog_title = SET_DOCUMENT_CONFIRM_DELETE_HEADER
+            c.dialog_text = SET_DOCUMENT_CONFIRM_DELETE_TEXT
             c.url_yes = "/document/globalDelete/%d/1" % id
             c.url_no = "/document/globalOverview/"
             return render('/documents/dialogs/confirm.mako')



More information about the Mpuls-commits mailing list