[Mpuls-commits] r4777 - in base/trunk: . mpulsweb/lib mpulsweb/templates/logbook

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Mar 11 12:48:05 CET 2011


Author: torsten
Date: 2011-03-11 12:48:05 +0100 (Fri, 11 Mar 2011)
New Revision: 4777

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/lib/config.py
   base/trunk/mpulsweb/lib/evaluation.py
   base/trunk/mpulsweb/lib/helpers.py
   base/trunk/mpulsweb/templates/logbook/evaluation.mako
Log:
Created default configuration for logbook which can be used as default. As the config is overwritten anyway this fixed some issues with the logbook if run as baseapplication but should have no effekt on other configurations


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2011-03-11 11:44:32 UTC (rev 4776)
+++ base/trunk/ChangeLog	2011-03-11 11:48:05 UTC (rev 4777)
@@ -2,6 +2,9 @@
 
 	* mpulsweb.egg-info/paste_deploy_config.ini_tmpl: Updated default ini file
 	* development.ini: Updated development.ini
+	* mpulsweb/lib/config.py: Set default options for logbook,
+	descriptions, categories and types. Need to be able to run the
+	base-application with default types and categories.
 
 2011-03-10  Roland Geider  <roland.geider at intevation.de>
 

Modified: base/trunk/mpulsweb/lib/config.py
===================================================================
--- base/trunk/mpulsweb/lib/config.py	2011-03-11 11:44:32 UTC (rev 4776)
+++ base/trunk/mpulsweb/lib/config.py	2011-03-11 11:48:05 UTC (rev 4777)
@@ -403,9 +403,15 @@
         # LOGBOOK
         # -------
         # Available types of entries
-        set('logbook', 'descriptions', [{}])
-        set('logbook', 'categories', [{}])
-        set('logbook', 'types', [{}])
+        set('logbook', 'descriptions', [{'-1': 'Keine Angabe', 
+                                         '-2': 'Sonstige Angaben'}])
+        set('logbook', 'categories', [{'name': 'Alle', 
+                                       'items': ['-1', '-2']}])
+        set('logbook', 'types', [{'db_field': 'art', 
+                                  'label': 'Art des Eintrags', 
+                                  'options': [{'label': 'Alle', 
+                                               'options': [['-1', 'Keine Angabe'], 
+                                                           ['-2', 'Sonstige Angaben']]}]}])
 
         #  EVALUATIONS
         # ------------

Modified: base/trunk/mpulsweb/lib/evaluation.py
===================================================================
--- base/trunk/mpulsweb/lib/evaluation.py	2011-03-11 11:44:32 UTC (rev 4776)
+++ base/trunk/mpulsweb/lib/evaluation.py	2011-03-11 11:48:05 UTC (rev 4777)
@@ -69,8 +69,9 @@
         result = {}
         for num, category in enumerate(g.mpuls_config.get('logbook',
                                                           'categories')):
-            for item in category.get('items'):
-                result[item] = [0, 0]
+            for item in category.get('items', []):
+		if item:
+                    result[item] = [0, 0]
             result['sum_cat%s' % num] = [0, 0]
         result['sum_all']= [0, 0]
         try:

Modified: base/trunk/mpulsweb/lib/helpers.py
===================================================================
--- base/trunk/mpulsweb/lib/helpers.py	2011-03-11 11:44:32 UTC (rev 4776)
+++ base/trunk/mpulsweb/lib/helpers.py	2011-03-11 11:48:05 UTC (rev 4777)
@@ -71,7 +71,7 @@
 
 def render_logbook_typeoptions(item):
     out = []
-    for i in item.get('options'):
+    for i in item.get('options', []):
         if isinstance(i, dict):
             out.append('<optgroup label="%s">' % i.get('label'))
             out.extend(render_logbook_typeoptions(i))

Modified: base/trunk/mpulsweb/templates/logbook/evaluation.mako
===================================================================
--- base/trunk/mpulsweb/templates/logbook/evaluation.mako	2011-03-11 11:44:32 UTC (rev 4776)
+++ base/trunk/mpulsweb/templates/logbook/evaluation.mako	2011-03-11 11:48:05 UTC (rev 4777)
@@ -17,7 +17,7 @@
         <b>${c.eval_effort['sum_cat%s' % num][1]}</b>
       </td>
     </tr>
-    % for item in category.get('items'):
+    % for item in category.get('items', []):
       <tr>
         <td style="padding-left:1em;">
           ${h.escape(g.mpuls_config.get('logbook', 'descriptions')[0].get(item))}



More information about the Mpuls-commits mailing list