[Mpuls-commits] r6002 - base/trunk/mpulsweb/templates/casemanagement

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Thu Jul 26 15:26:22 CEST 2012


Author: bricks
Date: 2012-07-26 15:26:22 +0200 (Thu, 26 Jul 2012)
New Revision: 6002

Modified:
   base/trunk/mpulsweb/templates/casemanagement/caselist.mako
Log:
Implement workaround for invalid phaseid in base too

Don't raise a traceback and a error 500 for the user if the phaseid and
therefore the phasepart is invalid.

mpuls/issue3303 (mpuls_S: AttributeError: 'NoneType' object has no attribute
'getDescription')


Modified: base/trunk/mpulsweb/templates/casemanagement/caselist.mako
===================================================================
--- base/trunk/mpulsweb/templates/casemanagement/caselist.mako	2012-07-26 09:48:16 UTC (rev 6001)
+++ base/trunk/mpulsweb/templates/casemanagement/caselist.mako	2012-07-26 13:26:22 UTC (rev 6002)
@@ -137,8 +137,14 @@
 <%def name="get_phase_icon(case)">
   <% phase = case.getState().getPhase() %>
   <% running = not phase%2 and 'running' or 'finished' %>
-  <% description = h.literal(c.phases.get_phase(str(phase)).getDescription()) %>
-  <% icon = c.phases.get_phase(str(phase)).getIcon() %>
+  <% phasepart = c.phases.get_phase(str(phase)) %>
+  <% phasepart = c.phases.get_phase(str(phase)) %>
+  %if not phasepart:
+      ## use unknown phase instead of causing traceback
+      <% phasepart = c.phases.get_phase("-1") %>
+  %endif
+  <% description = h.literal(phasepart.getDescription()) %>
+  <% icon = phasepart.getIcon() %>
   <img src="${h.url(str('/images/icons/case_status/%s_%s.png' % (icon, running)) )}" alt="${description}" title="${description}" width="22" height="22">
 </%def>
 



More information about the Mpuls-commits mailing list