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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Feb 1 17:05:43 CET 2010


Author: torsten
Date: 2010-02-01 17:05:41 +0100 (Mon, 01 Feb 2010)
New Revision: 1094

Modified:
   wasko/branches/2.0/waskaweb/controllers/casedocument.py
Log:
* waskaweb/controllers/casedocument.py (loadCase): New. Helper
	  function to load a case.
* waskaweb/controllers/casedocument.py
  (CasedocumentController.overview):: New. Method to build the
  casedocument list.


Modified: wasko/branches/2.0/waskaweb/controllers/casedocument.py
===================================================================
--- wasko/branches/2.0/waskaweb/controllers/casedocument.py	2010-02-01 16:03:37 UTC (rev 1093)
+++ wasko/branches/2.0/waskaweb/controllers/casedocument.py	2010-02-01 16:05:41 UTC (rev 1094)
@@ -4,13 +4,28 @@
 from pylons.controllers.util import abort, redirect_to
 
 from waskaweb.lib.base import BaseController, render
+from waskaweb.lib.security import checkRole
+from waskaweb.model.case import CaseFactory, LoadCaseNotExistsError
 
 log = logging.getLogger(__name__)
 
+def loadCase(id):
+    factory = CaseFactory()
+    try:
+        return factory.loadById(id)
+    except LoadCaseNotExistsError, err:
+        self.showError()
+
 class CasedocumentController(BaseController):
 
-    def index(self):
-        # Return a rendered template
-        #return render('/casedocument.mako')
-        # or, return a response
-        return 'Hello World'
+    @checkRole(('admin_ka', 'cm_ka'))
+    def index(self, id):
+        return self.overview(id)
+
+    @checkRole(('admin_ka', 'cm_ka'))
+    def overview(self, id):
+        id = self._checkInt(id)
+        case = loadCase(id)
+        c.files = case.getDocuments()
+        return render('/documents/case_overview.mako')
+



More information about the Mpuls-commits mailing list