--- /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/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>
-
- © 2009 Tero Marttila
+
+ <div id="footer-left">
+ © 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> & <a href="http://jigsaw.w3.org/css-validator/validator?uri=www.qmsk.net">CSS 2.1</a>
+ </div>
</div>
</body>
</html>