remove foo.html page, and rice up the footer a bit
authorTero Marttila <terom@fixme.fi>
Sat, 07 Feb 2009 04:57:22 +0200
changeset 26 9d3beac1b196
parent 25 8f143b1ce0d1
child 27 2acfbbe14226
remove foo.html page, and rice up the footer a bit
lib/config.py
lib/helpers.py
lib/page.py
lib/template.py
pages/foo.html
pages/list
static/style.css
templates/layout.tmpl
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/config.py	Sat Feb 07 04:57:22 2009 +0200
@@ -0,0 +1,7 @@
+"""
+    Configuration settings, preferences
+"""
+
+# datetime format for time.strftime
+DATETIME_FMT = "%Y/%m/%d %H:%M %Z"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/helpers.py	Sat Feb 07 04:57:22 2009 +0200
@@ -0,0 +1,15 @@
+"""
+    Helper functions for use in templates
+"""
+
+import time
+
+import config
+
+def now () :
+    """
+        Returns the current date/time
+    """
+
+    return time.strftime(config.DATETIME_FMT)
+
--- a/lib/page.py	Sat Feb 07 04:44:00 2009 +0200
+++ b/lib/page.py	Sat Feb 07 04:57:22 2009 +0200
@@ -14,6 +14,7 @@
 import template
 
 from page_tree import page_tree
+import config
 
 # path to directory containing the page heirarcy
 PAGE_DIR = "pages"
@@ -106,7 +107,7 @@
         # stat
         timestamp = os.stat(self.path).st_mtime
 
-        return time.strftime("%Y/%m/%d %H:%M %Z", time.gmtime(timestamp))
+        return time.strftime(config.DATETIME_FMT, time.gmtime(timestamp))
 
 class HTMLPage (Page) :
     """
--- a/lib/template.py	Sat Feb 07 04:44:00 2009 +0200
+++ b/lib/template.py	Sat Feb 07 04:57:22 2009 +0200
@@ -10,6 +10,8 @@
 # for http.ResponseError
 import http
 
+import helpers
+
 # path to template files
 TEMPLATE_DIR = "templates"
 
@@ -59,7 +61,13 @@
     """
 
     try :
-        return tpl.render_unicode(**params)
+        return tpl.render_unicode(
+            # global helper stuff
+            h           = helpers,
+
+            # render-specific params
+            **params
+        )
     
     # a template may render other templates
     except TemplateError :
--- a/pages/foo.html	Sat Feb 07 04:44:00 2009 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-
-<strong>HTML</strong> foo!
-
--- a/pages/list	Sat Feb 07 04:44:00 2009 +0200
+++ b/pages/list	Sat Feb 07 04:57:22 2009 +0200
@@ -1,6 +1,5 @@
 
             : Index
-foo             : Foo
 projects        : Projects
     qmsk.net        : qmsk.net
     nr-ttd          : Nr-TTD
--- a/static/style.css	Sat Feb 07 04:44:00 2009 +0200
+++ b/static/style.css	Sat Feb 07 04:57:22 2009 +0200
@@ -111,8 +111,17 @@
     font-style: italic;
 }
 
+div#footer-left {
+    float: left;
+}
+
 div#footer-right {
     float: right;
+    text-align: right;
+}
+
+div#footer-center {
+    text-align: center;
 }
 
 /*
--- a/templates/layout.tmpl	Sat Feb 07 04:44:00 2009 +0200
+++ b/templates/layout.tmpl	Sat Feb 07 04:57:22 2009 +0200
@@ -36,10 +36,17 @@
 
             <div id="footer">
                 <div id="footer-right">
-                    Modified ${page.modified}
+                    Page Modified ${page.modified} <br/>
+                    Current time ${h.now()}
                 </div>
-
-                &copy; 2009 Tero Marttila
+               
+                <div id="footer-left">
+                    &copy; 2009 Tero Marttila
+                </div>
+                
+                <div id="footer-center">
+                    Validated <a href="http://validator.w3.org/check?uri=www.qmsk.net">XHTML 1.0 Strict</a> &amp; <a href="http://jigsaw.w3.org/css-validator/validator?uri=www.qmsk.net">CSS 2.1</a>
+                </div>
             </div>
     </body>
 </html>