web/views/basetemplates.py
changeset 2559 46859078c866
parent 2555 ca7b122f34fa
child 2580 6e9453fd11ef
--- a/web/views/basetemplates.py	Wed Jul 29 10:43:30 2009 +0200
+++ b/web/views/basetemplates.py	Wed Jul 29 10:44:36 2009 +0200
@@ -13,7 +13,6 @@
 from cubicweb.vregistry import objectify_selector
 from cubicweb.selectors import match_kwargs
 from cubicweb.view import View, MainTemplate, NOINDEX, NOFOLLOW
-from cubicweb.web.views.basecontrollers import xhtml_wrap_header, xhtml_wrap_tail
 from cubicweb.utils import make_uid, UStringIO
 
 
@@ -85,12 +84,15 @@
     def call(self, view):
         view.set_request_content_type()
         view.set_stream()
-        if view.content_type == self.req.html_content_type():
-            view.w(xhtml_wrap_header(self))
+        if (self.req.form.has_key('__notemplate') and view.templatable
+            and view.content_type == self.req.html_content_type()):
+            view.w(self.req.document_surrounding_div())
             view.render()
-            view.w(xhtml_wrap_tail(self))
+            view.w(u'</div>')
         else:
             view.render()
+        # have to replace our stream by view's stream (which may be a binary
+        # stream)
         self._stream = view._stream