hooks/notification.py
branchstable
changeset 6760 2c1fc68ac258
parent 6466 43d71dd8a8ec
child 7068 90ddf608fe2b
--- a/hooks/notification.py	Tue Jan 04 11:59:11 2011 +0100
+++ b/hooks/notification.py	Tue Jan 04 13:42:01 2011 +0100
@@ -22,6 +22,7 @@
 
 from logilab.common.textutils import normalize_text
 
+from cubicweb import RegistryNotFound
 from cubicweb.selectors import is_instance
 from cubicweb.server import hook
 from cubicweb.sobjects.supervising import SupervisionMailOp
@@ -42,8 +43,14 @@
     category = 'notification'
 
     def select_view(self, vid, rset, row=0, col=0):
-        return self._cw.vreg['views'].select_or_none(vid, self._cw, rset=rset,
-                                                     row=row, col=col)
+        try:
+            return self._cw.vreg['views'].select_or_none(vid, self._cw, rset=rset,
+                                                         row=row, col=col)
+        except RegistryNotFound: # can happen in some config
+                                 # (e.g. repo only config with no
+                                 # notification views registered by
+                                 # the instance's cubes)
+            return None
 
 
 class StatusChangeHook(NotificationHook):
@@ -69,7 +76,6 @@
             'comment': comment, 'previous_state': entity.previous_state.name,
             'current_state': entity.new_state.name})
 
-
 class RelationChangeHook(NotificationHook):
     __regid__ = 'notifyrelationchange'
     events = ('before_add_relation', 'after_add_relation',