improve selector of RelatedObjectsVComponent: make sure the relation exists before fetching related entities
--- 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"""