[Mpuls-commits] r1111 - wasko/branches/2.0/waskaweb/controllers

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Feb 2 10:04:17 CET 2010


Author: torsten
Date: 2010-02-02 10:04:16 +0100 (Tue, 02 Feb 2010)
New Revision: 1111

Modified:
   wasko/branches/2.0/waskaweb/controllers/casedocument.py
Log:
* waskaweb/controllers/casedocument.py (CasedocumentController.show):
  New. Moved from controllers.document.


Modified: wasko/branches/2.0/waskaweb/controllers/casedocument.py
===================================================================
--- wasko/branches/2.0/waskaweb/controllers/casedocument.py	2010-02-02 08:53:59 UTC (rev 1110)
+++ wasko/branches/2.0/waskaweb/controllers/casedocument.py	2010-02-02 09:04:16 UTC (rev 1111)
@@ -1,6 +1,8 @@
 # -*- coding: utf-8 -*-
 import logging
 
+import paste
+
 from pylons import request, response, session, tmpl_context as c, h
 from pylons.controllers.util import abort, redirect_to
 
@@ -68,3 +70,19 @@
             c.failed_text = SET_ATTACHMENT_FAILED_TEXT
             c.url_ok = h.url_for(controller="/casedocument", action="new", id=case)
             return render('/documents/dialogs/failed_attachment.mako')
+
+    @checkRole(('admin_ka', 'cm_ka'))
+    def show(self, id):
+        id = self._checkInt(id)
+        try:
+            document = Document(id)
+            document.load(True)
+            data = paste.fileapp.DataApp(
+                document.data,
+                content_type=document.mime,
+                cache_control='must-revalidate',
+                pragma='public')
+            return data(request.environ, self.start_response)
+        except Exception, e:
+            log.exception(e)
+            redirect_to(controller="case", action="documents") 



More information about the Mpuls-commits mailing list