[Mpuls-commits] r3977 - in base/trunk: . mpulsweb/model

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Oct 14 13:29:39 CEST 2010


Author: bh
Date: 2010-10-14 13:29:38 +0200 (Thu, 14 Oct 2010)
New Revision: 3977

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/model/logbook.py
Log:
* mpulsweb/model/logbook.py (KIND2TEXT): Removed.  Access to the
app_globals (i.e. g), must not be done at module level because
it's only possible while handling a request and its value is
application specific.
(LogbookEntry.getKind): Directly access g.mpuls_config instead of
using the global KIND2TEXT.


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2010-10-14 09:33:52 UTC (rev 3976)
+++ base/trunk/ChangeLog	2010-10-14 11:29:38 UTC (rev 3977)
@@ -1,3 +1,12 @@
+2010-10-14  Bernhard Herzog  <bh at intevation.de>
+
+	* mpulsweb/model/logbook.py (KIND2TEXT): Removed.  Access to the
+	app_globals (i.e. g), must not be done at module level because
+	it's only possible while handling a request and its value is
+	application specific.
+	(LogbookEntry.getKind): Directly access g.mpuls_config instead of
+	using the global KIND2TEXT.
+
 2010-10-13  Bernhard Herzog  <bh at intevation.de>
 
 	Implement main part of mpuls/issue1266

Modified: base/trunk/mpulsweb/model/logbook.py
===================================================================
--- base/trunk/mpulsweb/model/logbook.py	2010-10-14 09:33:52 UTC (rev 3976)
+++ base/trunk/mpulsweb/model/logbook.py	2010-10-14 11:29:38 UTC (rev 3977)
@@ -38,7 +38,6 @@
 
 log = logging.getLogger(__name__)
 
-KIND2TEXT = g.mpuls_config.get('logbook', 'descriptions')[0]
 
 ALLOWED_SORTING = ['name', 'art', 'dauer', 'datum', 'asc', 'desc', 'bearbeiter']
 LOAD_LOGBOOK = """
@@ -149,7 +148,8 @@
     def getKind(self, empty='-/-'):
         if self.art == -2:
             return "%s" % self.getShortNotice(empty)
-        return KIND2TEXT.get(str(self.art), empty)
+        descriptions = g.mpuls_config.get('logbook', 'descriptions')[0]
+        return descriptions.get(str(self.art), empty)
 
     def setKind(self, art):
         self.art = art



More information about the Mpuls-commits mailing list