improve selector of RelatedObjectsVComponent: make sure the relation exists before fetching related entities tls-sprint
authorAdrien Di Mascio <Adrien.DiMascio@logilab.fr>
Wed, 18 Feb 2009 17:04:18 +0100
branchtls-sprint
changeset 817 12320ff8d6e4
parent 813 69c623aa39ed
child 818 dc45e3cc487c
improve selector of RelatedObjectsVComponent: make sure the relation exists before fetching related entities
web/component.py
--- a/web/component.py	Wed Feb 18 16:55:01 2009 +0100
+++ b/web/component.py	Wed Feb 18 17:04:18 2009 +0100
@@ -14,7 +14,7 @@
 from cubicweb.view import View, Component
 from cubicweb.selectors import (
     paginated_rset, one_line_rset, primary_view, match_context_prop,
-    abstract_has_related_entities,
+    abstract_has_related_entities, abstract_relation_possible,
     condition_compat, accepts_compat, has_relation_compat)
 from cubicweb.common.registerers import accepts_registerer
 
@@ -143,7 +143,7 @@
 class RelatedObjectsVComponent(EntityVComponent):
     """a section to display some related entities"""
     vid = 'list'
-    __select__ = abstract_has_related_entities()
+    __select__ = abstract_relation_possible() & abstract_has_related_entities()
     
     def rql(self):
         """override this method if you want to use a custom rql query"""