[views] Protect scoredefinition primary view when no scorevalues are available
authorVincent Michel <vincent.michel@logilab.fr>
Thu, 01 Aug 2013 16:05:00 +0200
changeset 371 e62367d9141a
parent 366 0518974bc7f4
child 385 e637f05706e8
[views] Protect scoredefinition primary view when no scorevalues are available
views/primary.py
--- a/views/primary.py	Sat Jul 27 12:57:27 2013 +0200
+++ b/views/primary.py	Thu Aug 01 16:05:00 2013 +0200
@@ -297,11 +297,13 @@
     def display_main_col(self, entity):
         # Scores
         w = self.w
+        rset = self._cw.execute('Any S,V,T,DA WHERE S is ScoreValue, S value V, S text T, '
+                                'S datetime DA, S definition D, D eid %(e)s', {'e': entity.eid})
+        if not rset:
+            return
         w(u'<table class="table table-striped table-bordered table-condensed">')
         w(u'<tr><th>%s</th><th>%s</th><th>%s</th></tr>'
           % (self._cw._('Subject'), self._cw._('value'), self._cw._('datetime')))
-        rset = self._cw.execute('Any S,V,T,DA WHERE S is ScoreValue, S value V, S text T, '
-                                'S datetime DA, S definition D, D eid %(e)s', {'e': entity.eid})
         # Warm subjects
         score = rset.get_entity(0, 0)
         if score.reverse_related_infos: