add initial created/modified time support
M muyhomepage2/page.py +18 -0
@@ 63,6 63,24 @@ class Page(object):
         else:
             return []
 
+    def created(self):
+        if self.headers.get('created'):
+            return util.When.parse(self.headers['created'])
+        else:
+            return util.When(self._ctime())
+
+    def modified(self):
+        if self.headers.get('modified'):
+            return util.When.parse(self.headers['modified'])
+        else:
+            return util.When(self._mtime())
+
+    def _ctime(self):
+        return os.path.getctime(self.filename)
+
+    def _mtime(self):
+        return os.path.getmtime(self.filename)
+
 
 class PseduoPage(object):
     def __init__(self, filename, contentcode, title, action):

          
M muyhomepage2/pagehandlers/handler.py +8 -0
@@ 12,6 12,14 @@ class PageHandler(object):
     def tags(self):
         return sorted(self.page.tags)
 
+    @property
+    def createdon(self):
+        return self.page.created()
+
+    @property
+    def modifiedon(self):
+        return self.page.modified()
+
     def finalname(self):
         if 'x-force-file-name' in self.page.headers:
             return self.page.headers['x-force-file-name']

          
M muyhomepage2/pagehandlers/software.py +0 -2
@@ 56,8 56,6 @@ class SoftwareInfo(object):
 
     @property
     def sources(self):
-    # Software-RCS: Hg
-    # Software-RCS-Url: http://hg.asynchrono.us/scrob-ws
         rcs = self.page.headers.get('software-rcs')
         if not rcs:
             return []

          
M muyhomepage2/util.py +40 -0
@@ 9,8 9,14 @@ 
 """
 
 import string
+import time, calendar
 from hashlib import md5
 
+TIME_FMT_MUY    = '%Y-%m-%d %H:%M %Z'
+TIME_FMT_822    = '%a, %d %b %Y %H:%M:%S %Z'
+TIME_FMT_3339   = '%Y-%m-%dT%H:%M:%SZ'
+TIME_FMT_ATOMID = '%Y-%m-%d'
+
 
 def encodetitle(title):
     """Create a simplified title string.

          
@@ 46,3 52,37 @@ def contentcode(filename):
     finally:
         fp.close()
     return csum.hexdigest()
+
+
+class When(object):
+    def __init__(self, wtime):
+        self._time = wtime
+
+    def local(self):
+        return time.localtime(self._time)
+
+    def utc(self):
+        return time.gmtime(self._time)
+
+    def __str__(self):
+        return time.strftime(TIME_FMT_MUY, self.local())
+
+    def storefmt(self):
+        return time.strftime(TIME_FMT_MUY, self.utc())
+
+    @classmethod
+    def parse(cls, txt):
+        utc = True
+        if not txt.endswith("UTC"):
+            utc = False
+        tm = time.strptime(txt, TIME_FMT_MUY)
+        if utc:
+            etime = calendar.timegm(tm) 
+        else:
+            etime = time.mktime(tm)
+        return cls(etime)
+
+    @classmethod
+    def now(cls):
+        return cls(time.time())
+

          
M skins/default/base.html +0 -12
@@ 107,18 107,6 @@ 
   <!-- begin main content section -->
   <div id="page-main">
   {% block main %}
-  {% macro tidbits(_current) %}
-    <ul class="tidbits">
-      <li>
-          <a href="mailto:phglogistonjohn+web@gmail.com?={{_current.page.title}}">
-              Comment on {{_current.page.title}}
-          </a>
-      </li>
-      <li>
-          <!-- repeat tidbits -->
-      </li>
-    </ul>
-  {% endmacro %}
   {% endblock %}
   </div>
   <!-- end main content section -->