web/views/basetemplates.py
changeset 2555 ca7b122f34fa
parent 2381 caad2367d940
child 2559 46859078c866
--- a/web/views/basetemplates.py	Tue Jul 28 10:19:14 2009 +0200
+++ b/web/views/basetemplates.py	Tue Jul 28 10:23:48 2009 +0200
@@ -13,8 +13,10 @@
 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
 
+
 # main templates ##############################################################
 
 class LogInOutTemplate(MainTemplate):
@@ -83,15 +85,12 @@
     def call(self, view):
         view.set_request_content_type()
         view.set_stream()
-        xhtml_wrap = (self.req.form.has_key('__notemplate') and view.templatable
-                      and view.content_type == self.req.html_content_type())
-        if xhtml_wrap:
-            view.w(u'<?xml version="1.0"?>\n' + self.doctype)
-            view.w(u'<div xmlns="http://www.w3.org/1999/xhtml" xmlns:cubicweb="http://www.logilab.org/2008/cubicweb">')
-        # have to replace our unicode stream using view's binary stream
-        view.render()
-        if xhtml_wrap:
-            view.w(u'</div>')
+        if view.content_type == self.req.html_content_type():
+            view.w(xhtml_wrap_header(self))
+            view.render()
+            view.w(xhtml_wrap_tail(self))
+        else:
+            view.render()
         self._stream = view._stream