[Mpuls-commits] r2342 - wasko/branches/2.0/mpulsweb/lib

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Apr 14 14:52:10 CEST 2010


Author: torsten
Date: 2010-04-14 14:52:09 +0200 (Wed, 14 Apr 2010)
New Revision: 2342

Modified:
   wasko/branches/2.0/mpulsweb/lib/base.py
Log:
* mpulsweb/lib/base.py (BaseController.__before__): Added code to load
	navigation to lib base, as it is used at more places.


Modified: wasko/branches/2.0/mpulsweb/lib/base.py
===================================================================
--- wasko/branches/2.0/mpulsweb/lib/base.py	2010-04-14 10:49:57 UTC (rev 2341)
+++ wasko/branches/2.0/mpulsweb/lib/base.py	2010-04-14 12:52:09 UTC (rev 2342)
@@ -44,6 +44,7 @@
 
 import mpulsweb.lib.db as db
 from mpulsweb.lib.timelog import timeLog
+from mpulsweb.lib.navigation import get_navigation
 
 import mpulsweb.lib.helpers as h
 from mpulsweb.lib.security import getDbName, userIdentity
@@ -71,8 +72,26 @@
         self.page_cache = None
 
     def _loadCase(self, id):
-        return g.case_factory.loadById(id)
+        case = g.case_factory.loadById(id)
+        session_case = case.getSessionCase()
+        if session.has_key('case'):
+            old_caseid = session.get('case').id
+        else: old_caseid = None
 
+        # New session code
+        session['case'] = session_case
+
+        # Only reset navigation if case is switched
+        log.debug("%s (%s) == %s (%s))" % (old_caseid, type(old_caseid), id, type(id)))
+        if old_caseid != id:
+            open_folders = []
+            navigation = get_navigation(id)
+            session['render_mode'] = 'ro'
+            session['navigation.tree'] = navigation
+            session['navigation.openfolders'] = open_folders
+        session.save()
+        return case
+
     def __before__(self):
         try:
             storedHash = session['AUTH']



More information about the Mpuls-commits mailing list