[Mpuls-commits] r565 - in wasko/trunk/waskaweb: controllers lib

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Jul 29 16:10:44 CEST 2009


Author: torsten
Date: 2009-07-29 16:10:44 +0200 (Wed, 29 Jul 2009)
New Revision: 565

Modified:
   wasko/trunk/waskaweb/controllers/formularpage.py
   wasko/trunk/waskaweb/controllers/repeatgroup.py
   wasko/trunk/waskaweb/lib/renderer_new.py
Log:
Provied instancetree in renderes


Modified: wasko/trunk/waskaweb/controllers/formularpage.py
===================================================================
--- wasko/trunk/waskaweb/controllers/formularpage.py	2009-07-29 13:21:38 UTC (rev 564)
+++ wasko/trunk/waskaweb/controllers/formularpage.py	2009-07-29 14:10:44 UTC (rev 565)
@@ -35,10 +35,10 @@
     if page:
         c.formularheader = "<h1>%s</h1>" % page.getMeta().getDescription()
         if isinstance(page, RepeatInstanceContainerNode):
-            renderer      = RepeatGroupRenderer(page,session.get('render_mode', 'ro')=='ro')
+            renderer      = RepeatGroupRenderer(instance_tree, page,session.get('render_mode', 'ro')=='ro')
         else:
             c.formularerrors = "Fehler" 
-            renderer      = ViewRenderer(page,session.get('render_mode', 'ro')=='ro')
+            renderer      = ViewRenderer(instance_tree, page,session.get('render_mode', 'ro')=='ro')
         #errorrenderer = ErrorRenderer(page.getErrors(), page.getWarnings()) 
         #log.debug('select: errorrenderer ok: %s' % errorrenderer)
         #c.formularerrors = errorrenderer.render(page) 

Modified: wasko/trunk/waskaweb/controllers/repeatgroup.py
===================================================================
--- wasko/trunk/waskaweb/controllers/repeatgroup.py	2009-07-29 13:21:38 UTC (rev 564)
+++ wasko/trunk/waskaweb/controllers/repeatgroup.py	2009-07-29 14:10:44 UTC (rev 565)
@@ -11,7 +11,6 @@
 from waskaweb.lib.base import BaseController, render
 from waskaweb.lib.db import  PostgresDBInterface
 
-from waskaweb.lib.renderer_new import  ViewRenderer, ErrorRenderer
 from waskaweb.lib.navigation import  get_navigation 
 from waskaweb.controllers.formularpage import FormularpageController 
 from formed.instance.backends.postgres import DBFactory as InstanceFactory

Modified: wasko/trunk/waskaweb/lib/renderer_new.py
===================================================================
--- wasko/trunk/waskaweb/lib/renderer_new.py	2009-07-29 13:21:38 UTC (rev 564)
+++ wasko/trunk/waskaweb/lib/renderer_new.py	2009-07-29 14:10:44 UTC (rev 565)
@@ -117,7 +117,8 @@
 
 class ViewRenderer:
 
-    def __init__(self, page=None, ro_mode=True):
+    def __init__(self, it=None, page=None, ro_mode=True):
+        self.it              = it # instancetree
         self.page            = page
         self.stateStack      = None
         self.containersStack = None
@@ -643,8 +644,6 @@
         out     = []
         fields  = []
         case_id = rg.getIdentifier().split(':')[-1]
-        factory = InstanceFactory(g.formedTree, PostgresDBInterface())
-        it      = factory.loadInstanceTreeByIdentifier(case_id) 
         digests = rgdigests = {'rg_unterstuetzung': ['hilfm_art', 'hilfm_inst', 'hilfm_einr', 'hilfm_start', 'hilfm_ende'], 'rg_kompetenz': ['datum_kf', 'kf_anbiet']}
 
         if digests:
@@ -655,7 +654,7 @@
             out.append('<tr><td>%s</td></tr>' % rg.getIdentifier())
         else:
             for num, field in enumerate(fields):
-                item = it.getItem('%s:%s:%s' % (field, rg.getInternalIdentifier(), case_id))
+                item = self.it.getItem('%s:%s:%s' % (field, rg.getInternalIdentifier(), case_id))
                 out.append('<tr>')
                 out.append('<td class="label">')
                 out.append('<a href="/navigation/select_branch/%s">' % rg.getChildren()[0].getIdentifier())



More information about the Mpuls-commits mailing list