[views] Fix device in primary view of scan
authorVincent Michel <vincent.michel@logilab.fr>
Tue, 16 Jul 2013 16:24:50 +0200
changeset 303 5b7153bafd9e
parent 302 8cd93f6c084c
child 304 d59f33992acb
[views] Fix device in primary view of scan
views/primary.py
--- a/views/primary.py	Tue Jul 16 16:15:17 2013 +0200
+++ b/views/primary.py	Tue Jul 16 16:24:50 2013 +0200
@@ -552,8 +552,11 @@
     def iterate_attributes(self, entity):
         subject = entity.concerns[0]
         subject = u'<a href="%s">%s</a>' % (subject.absolute_url(), subject.dc_title())
-        device = entity.uses_device[0]
-        device = u'<a href="%s">%s</a>' % (device.absolute_url(), device.dc_title())
+        device = entity.uses_device
+        if entity.uses_device:
+            device = u'<a href="%s">%s</a>' % (device[0].absolute_url(), device[0].dc_title())
+        else:
+            device = None
         assessment = entity.reverse_generates[0]
         assessment = u'<a href="%s">%s</a>' % (assessment.absolute_url(), assessment.dc_title())
         return [(self._cw._('Identifier'), entity.identifier),
@@ -570,7 +573,7 @@
         w = self.w
         w(u'<div class="well">')
         w(u'<div class="page-header">')
-        w(u'<h1>%s</h1>' % entity.dc_title())
+        w(u'<h2>%s</h2>' % entity.dc_title())
         w(u'</div>')
         w(u'<dl class="dl-horizontal">')
         for label, attribute in self.iterate_attributes(entity):