[Mpuls-commits] r1411 - in wasko/branches/2.0: . waskaweb/controllers

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Feb 9 16:51:38 CET 2010


Author: bh
Date: 2010-02-09 16:51:36 +0100 (Tue, 09 Feb 2010)
New Revision: 1411

Modified:
   wasko/branches/2.0/ChangeLog
   wasko/branches/2.0/waskaweb/controllers/annotations.py
Log:
* waskaweb/controllers/annotations.py
(AnnotationsController.help): Make this work for ids that don't
refer to formed components such as 'wiederaufnahme' and
'neuaufnahme'


Modified: wasko/branches/2.0/ChangeLog
===================================================================
--- wasko/branches/2.0/ChangeLog	2010-02-09 15:32:07 UTC (rev 1410)
+++ wasko/branches/2.0/ChangeLog	2010-02-09 15:51:36 UTC (rev 1411)
@@ -1,5 +1,12 @@
 2010-02-09  Bernhard Herzog  <bh at intevation.de>
 
+	* waskaweb/controllers/annotations.py
+	(AnnotationsController.help): Make this work for ids that don't
+	refer to formed components such as 'wiederaufnahme' and
+	'neuaufnahme'
+
+2010-02-09  Bernhard Herzog  <bh at intevation.de>
+
 	* waskaweb/controllers/annotations.py (AnnotationsController.help)
 	(AnnotationsController.required)
 	(AnnotationsController.evaluation): Fix abort calls.  abort always

Modified: wasko/branches/2.0/waskaweb/controllers/annotations.py
===================================================================
--- wasko/branches/2.0/waskaweb/controllers/annotations.py	2010-02-09 15:32:07 UTC (rev 1410)
+++ wasko/branches/2.0/waskaweb/controllers/annotations.py	2010-02-09 15:51:36 UTC (rev 1411)
@@ -15,12 +15,25 @@
 
     @checkRole(('admin_ka', 'cm_ka', 'pt_dlr'))
     def help(self, id):
+        """Show help for the given id.
+        The id is first looked up in the formed tree, because its node
+        components also have a description that can be used as a title.
+        However, not all help texts refer to formed tree components (for
+        instances 'wiederaufnahme' and 'neuaufnahme'), so helpData is
+        searched directly as well.
+        """
         nc = g.formedTree.findByName(id)
-        if not nc:
-            abort(404, _('No help available'))
+        if nc is not None:
+            text = nc.getHelp()
+            title = nc.getDescription()
+        else:
+            text = g.helpData.getHelp(id)
+            if text is None:
+                abort(404, _('No help available'))
+            title = ""
         c.annotation_header = _('Help')
-        c.annotation_title = nc.getDescription()
-        c.annotation_text = nc.getHelp()
+        c.annotation_title = title
+        c.annotation_text = text
         return render('/annotations/annotation.mako')
 
     @checkRole(('admin_ka', 'cm_ka', 'pt_dlr'))



More information about the Mpuls-commits mailing list