diff bitsyblog/utils.py @ 84:e5a23f5ea14e

make cooked bodies depend on file mtime
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 17 Nov 2011 13:18:51 -0800
parents 4df927b0d847
children 8f30c2f702bc
line wrap: on
line diff
--- a/bitsyblog/utils.py	Thu Nov 17 12:15:43 2011 -0800
+++ b/bitsyblog/utils.py	Thu Nov 17 13:18:51 2011 -0800
@@ -17,11 +17,10 @@
 
 def ReST2html(string):
     """renders a string with restructured text"""
-    
+
     settings = { 'report_level': 5 }
     string = string.strip()
     try:
-            
         parts = docutils.core.publish_parts(string,
                                             writer_name='html',
                                             settings_overrides=settings)
@@ -32,7 +31,7 @@
     return body
 
 def validate_css(css):
-    """use a webservice to determine if the argument is valid css"""    
+    """use a webservice to determine if the argument is valid css"""
     url = 'http://jigsaw.w3.org/css-validator/validator?text=%s'
     url = url % urllib.quote_plus(css)
     foo = urllib2.urlopen(url)
@@ -48,6 +47,8 @@
     return datetime.datetime(*retval)
 
 def datestamp(date=None):
+    if isinstance(date, float):
+        date = datetime.datetime.fromtimestamp(date)
     if date is None:
         date = datetime.datetime.now()
     return date.strftime(timestamp)