[views] Fix bad rset definition in QuestionnaireRun primary view
authorVincent Michel <vincent.michel@logilab.fr>
Wed, 03 Jul 2013 17:23:34 +0200
changeset 183 c9fd41f0b0c8
parent 182 70969303e596
child 184 b9b6788b9123
[views] Fix bad rset definition in QuestionnaireRun primary view
views/primary.py
--- a/views/primary.py	Wed Jul 03 17:22:09 2013 +0200
+++ b/views/primary.py	Wed Jul 03 17:23:34 2013 +0200
@@ -24,17 +24,17 @@
 
     def call(self, rset=None):
         super(BrainomicsQuestionnaireRunPrimaryView, self).call(rset=rset)
+        rset = rset or self.cw_rset
+        entity = rset.get_entity(0, 0)
         # Add measures
-        rset = rset or self.cw_rset
         rset = self._cw.execute('Any X WHERE X is ScoreValue, X measure Q, Q eid %(q)s',
-                                {'q': rset.get_entity(0, 0).eid})
+                                {'q': entity.eid})
         if rset:
             self.w(u'<h3>%s</h3>' % self._cw._('Additional scores'))
             self.wview('list', rset=rset)
         # Add external resources
-        rset = rset or self.cw_rset
         rset = self._cw.execute('Any X WHERE X is ExternalResource, Q external_resources X, Q eid %(q)s',
-                                {'q': rset.get_entity(0, 0).eid})
+                                {'q': entity.eid})
         if rset:
             self.w(u'<h3>%s</h3>' % self._cw._('Additional resources'))
             self.wview('list', rset=rset)