You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bloodhound.apache.org by gj...@apache.org on 2012/06/18 13:50:48 UTC

svn commit: r1351304 - /incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/web_ui.py

Author: gjm
Date: Mon Jun 18 11:50:47 2012
New Revision: 1351304

URL: http://svn.apache.org/viewvc?rev=1351304&view=rev
Log:
dashboard: improvement to error handling with rendering widgets (on top of #81) - towards #93 (from olemis)

Modified:
    incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/web_ui.py

Modified: incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/web_ui.py
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/web_ui.py?rev=1351304&r1=1351303&r2=1351304&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/web_ui.py (original)
+++ incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/web_ui.py Mon Jun 18 11:50:47 2012
@@ -44,7 +44,7 @@ from trac.web.api import IRequestHandler
 from trac.web.chrome import add_ctxtnav, add_stylesheet, Chrome, \
                             INavigationContributor, ITemplateProvider
 
-from bhdashboard.api import DashboardSystem
+from bhdashboard.api import DashboardSystem, InvalidIdentifier
 from bhdashboard import _json
 
 class DashboardModule(Component):
@@ -230,6 +230,8 @@ class DashboardModule(Component):
         """Render widget without failing.
         """
         try :
+            if wp is None :
+                raise InvalidIdentifier("Unknown widget ID")
             return wp.render_widget(name, ctx, options)
         except Exception, exc:
             log_entry = str(uuid4())
@@ -263,7 +265,7 @@ class DashboardModule(Component):
         self.log.debug("Bloodhound: Widget index %s" % (widgets_index,))
         ctx = Context.from_request(req)
         for w in widgets_spec.itervalues():
-            w['c'] = widgets_index[w['args'][0]]
+            w['c'] = widgets_index.get(w['args'][0])
             w['args'][1] = ctx
         self.log.debug("Bloodhound: Widget specs %s" % (widgets_spec,))
         chrome = Chrome(self.env)