merge tls-sprint
authorsylvain.thenault@logilab.fr
Wed, 18 Feb 2009 17:23:54 +0100
branchtls-sprint
changeset 820 fcc11122ffe7
parent 819 7fd66f389ef7 (current diff)
parent 818 dc45e3cc487c (diff)
child 821 78cc1682c3a4
merge
web/views/basetemplates.py
--- a/web/component.py	Wed Feb 18 17:22:10 2009 +0100
+++ b/web/component.py	Wed Feb 18 17:23:54 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"""
--- a/web/views/basetemplates.py	Wed Feb 18 17:22:10 2009 +0100
+++ b/web/views/basetemplates.py	Wed Feb 18 17:23:54 2009 +0100
@@ -121,13 +121,13 @@
         view.set_http_cache_headers()
         req.validate_cache()
         with_templates = self.with_templates(view)
-        if not with_templates:
-            view.set_request_content_type()
-            self.set_stream(templatable=False)
-        else:
+        if with_templates:
             self.set_request_content_type()
             content_type = self.content_type
             self.template_header(content_type, view)
+        else:
+            view.set_request_content_type()
+            self.set_stream(templatable=False)
         self.wview('page-content', view=view, rset=rset)
         if with_templates:
             self.template_footer(view)
@@ -209,7 +209,6 @@
     id = 'page-content'
 
     def call(self, view=None, rset=None):
-        self.req.set_header('x-cubicweb-css', 'a.css;b.css')
         if view is None:
             view, rset = self._select_view_and_rset()
         with_templates = self.with_templates(view)
@@ -229,6 +228,8 @@
                             not (view and view.need_navigation))
             w(_(self.nav_html.getvalue()))
             w(u'<div id="contentmain">\n')
+        else:
+            self.set_stream(templatable=False)            
         if view.binary:
             # have to replace our unicode stream using view's binary stream
             view.dispatch()