changeset 21:db5af17f4933

updated SrvTxtUtils to 1.3
author casties
date Mon, 16 Jan 2012 17:57:53 +0100
parents 9a1e75e708e1
children 24214a828627
files SrvTxtUtils.py
diffstat 1 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/SrvTxtUtils.py	Sun Oct 23 21:29:02 2011 +0200
+++ b/SrvTxtUtils.py	Mon Jan 16 17:57:53 2012 +0100
@@ -1,12 +1,17 @@
 """Utility methods for handling XML, reading HTTP, etc"""
 
+from App.ImageFile import ImageFile
+from App.Common import rfc1123_date
+
 import sys
+import os
+import stat
 import urllib
 import urllib2
 import logging
 
 
-srvTxtUtilsVersion = "1.2"
+srvTxtUtilsVersion = "1.3"
 
 def getInt(number, default=0):
     """returns always an int (0 in case of problems)"""
@@ -92,3 +97,13 @@
     raise IOError("ERROR fetching HTTP data from %s: %s"%(url,errmsg))
     #return None
 
+
+def refreshingImageFileIndexHtml(self, REQUEST, RESPONSE):
+    """index_html method for App.ImageFile that updates the file info for each request."""
+    stat_info = os.stat(self.path)
+    self.size = stat_info[stat.ST_SIZE]
+    self.lmt = float(stat_info[stat.ST_MTIME]) or time.time()
+    self.lmh = rfc1123_date(self.lmt)
+    # call original method
+    return ImageFile.index_html(self, REQUEST, RESPONSE)
+