qmsk.web.html: HTMLMixin
authorTero Marttila <terom@paivola.fi>
Thu, 29 Jan 2015 22:14:59 +0200
changeset 102 611787305686
parent 101 18c461237630
child 103 5263f65c990e
qmsk.web.html: HTMLMixin
qmsk/web/html.py
--- a/qmsk/web/html.py	Tue Dec 02 00:23:48 2014 +0200
+++ b/qmsk/web/html.py	Thu Jan 29 22:14:59 2015 +0200
@@ -1,7 +1,7 @@
 from qmsk.utils import flatten, merge
 from html import escape
 
-import qmsk.web
+import qmsk.web.application
 
 class Tag :
     def __init__ (self, _name=None, *_contents,
@@ -105,7 +105,7 @@
 
 html5   = HTML5()
 
-class HTMLHandler (qmsk.web.Handler):
+class HTMLMixin:
     """
         A handler that renders a full HTML page.
     """
@@ -142,9 +142,13 @@
 
         html = self.html
 
+        title = self.title()
+
+        assert title
+
         return html.html(
             html.head(
-                html.title(self.title()),
+                html.title(title),
                 (
                     html.link(rel='Stylesheet', type="text/css", href=src) for src in self.CSS
                 ), 
@@ -186,3 +190,7 @@
             ))
         ),
     ))
+
+class HTMLHandler (HTMLMixin, qmsk.web.application.Handler):
+    pass
+